Skip to content

Commit 61daf02

Browse files
committed
Prevent crash when no tags found
1 parent 46c2c12 commit 61daf02

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/org/opensolaris/opengrok/analysis/JFlexXref.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,15 @@ protected String getProjectPostfix(boolean encoded) {
238238
protected void startScope() {
239239
if (scopesEnabled && scope == null) {
240240
int line = getLineNumber();
241-
List<Tag> tags = defs.getTags(line);
242-
if (tags != null) {
243-
for (Tag tag : tags) {
244-
if (tag.type.startsWith("function") || tag.type.startsWith("method")) {
245-
scope = new Scope(tag.line, tag.line, tag.symbol, tag.namespace, tag.signature);
246-
scopeLevel = 0;
247-
break;
241+
if (defs != null) {
242+
List<Tag> tags = defs.getTags(line);
243+
if (tags != null) {
244+
for (Tag tag : tags) {
245+
if (tag.type.startsWith("function") || tag.type.startsWith("method")) {
246+
scope = new Scope(tag.line, tag.line, tag.symbol, tag.namespace, tag.signature);
247+
scopeLevel = 0;
248+
break;
249+
}
248250
}
249251
}
250252
}

0 commit comments

Comments
 (0)