Skip to content

Commit

Permalink
Fixed NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertBColton committed Jun 6, 2013
1 parent 9add999 commit 3f667d4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion org/lateralgm/file/GmFileReader.java
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2006-2011 IsmAvatar <IsmAvatar@gmail.com> a * Copyright (C) 2006-2011 IsmAvatar <IsmAvatar@gmail.com>
* Copyright (C) 2006, 2007, 2008 Clam <clamisgood@gmail.com> * Copyright (C) 2006, 2007, 2008 Clam <clamisgood@gmail.com>
* Copyright (C) 2007, 2008, 2009 Quadduc <quadduc@gmail.com> * Copyright (C) 2007, 2008, 2009 Quadduc <quadduc@gmail.com>
* Copyright (C) 2013, Robert B. Colton * Copyright (C) 2013, Robert B. Colton
Expand Down Expand Up @@ -1182,6 +1182,12 @@ private static void readActions(GmFileContext c, ActionContainer container, Stri
la.id = actid; la.id = actid;
la.parentId = libid; la.parentId = libid;
la.actionKind = (byte) in.read4(); la.actionKind = (byte) in.read4();
if (la.actionKind == Action.ACT_CODE) {
la = LibManager.codeAction;
in.skip(16);
in.skip(in.read4());
in.skip(in.read4());
} else {
la.allowRelative = in.readBool(); la.allowRelative = in.readBool();
la.question = in.readBool(); la.question = in.readBool();
la.canApplyTo = in.readBool(); la.canApplyTo = in.readBool();
Expand All @@ -1195,6 +1201,7 @@ private static void readActions(GmFileContext c, ActionContainer container, Stri
else else
in.skip(in.read4()); in.skip(in.read4());
} }
}
else else
{ {
in.skip(20); in.skip(20);
Expand Down

1 comment on commit 3f667d4

@RobertBColton
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What this change did was make it possible to disable loading the action libraries but still be able to use the code action. This was for the feature originally added to master that allowed you to disable drag and drop. It was later discovered that this was not possible and had to be reverted because of an issue with the EGM format. However, it would still be ok to make this change in the rare event that all action libraries fail to load or are missing, then at least the code action works.

Please sign in to comment.