nullpointer fix

This commit is contained in:
Jindra Petřík
2015-11-18 19:53:28 +01:00
parent 315ecb0d58
commit dd7016bb87

View File

@@ -971,12 +971,20 @@ public class Graph {
if (stopPart.contains(part)) {
return null;
}
GraphSourceItem firstIns = null;
if (part != null) {
if (part.start >= 0 && part.start < code.size()) {
firstIns = code.get(part.start);
}
}
for (Loop l : loops) {
if (l.loopContinue == part) {
return (new ContinueItem(null, part == null ? null : code.get(part.start), l.id));
return (new ContinueItem(null, firstIns, l.id));
}
if (l.loopBreak == part) {
return (new BreakItem(null, part == null ? null : code.get(part.start), l.id));
return (new BreakItem(null, firstIns, l.id));
}
}
return null;