Skip to content
This repository has been archived by the owner on Jan 27, 2019. It is now read-only.

Commit

Permalink
Improve exception message when protection not found
Browse files Browse the repository at this point in the history
  • Loading branch information
yck1509 committed Nov 18, 2015
1 parent c79a032 commit 5a849c7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Confuser.Core/ObfAttrParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ public void ParseProtectionString(ProtectionSettings settings, string str) {

case ParseState.EndItem:
if (settings != null) {
if (!items.Contains(protId))
throw new KeyNotFoundException("Cannot find protection with id '" + protId + "'.");

if (protAct) {
settings[(Protection)items[protId]] = protParams;
}
Expand Down Expand Up @@ -243,7 +246,11 @@ public void ParsePackerString(string str, out Packer packer, out Dictionary<stri
case ParseState.ReadItemName:
ReadId(buffer);

packer = (Packer)items[buffer.ToString()];
var packerId = buffer.ToString();
if (!items.Contains(packerId))
throw new KeyNotFoundException("Cannot find packer with id '" + packerId + "'.");

packer = (Packer)items[packerId];
buffer.Length = 0;

if (IsEnd() || Peek() == ';')
Expand Down

0 comments on commit 5a849c7

Please sign in to comment.