From 942d99fda384d248e6a77a8c3101afe772320560 Mon Sep 17 00:00:00 2001 From: Runemoro Date: Thu, 19 Mar 2020 18:30:59 -0400 Subject: Fix CFR-related bugs --- src/main/java/cuchaz/enigma/source/procyon/index/TokenFactory.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/main/java/cuchaz/enigma/source/procyon') diff --git a/src/main/java/cuchaz/enigma/source/procyon/index/TokenFactory.java b/src/main/java/cuchaz/enigma/source/procyon/index/TokenFactory.java index db90ffa..62e7c10 100644 --- a/src/main/java/cuchaz/enigma/source/procyon/index/TokenFactory.java +++ b/src/main/java/cuchaz/enigma/source/procyon/index/TokenFactory.java @@ -17,6 +17,11 @@ public class TokenFactory { String name = node instanceof Identifier ? ((Identifier) node).getName() : ""; Region region = node.getRegion(); + if (region.getBeginLine() == 0) { + System.err.println("Got bad region from Procyon for node " + node); + return null; + } + int start = index.getPosition(region.getBeginLine(), region.getBeginColumn()); int end = index.getPosition(region.getEndLine(), region.getEndColumn()); String text = index.getSource().substring(start, end); -- cgit v1.2.3