mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 08:48:55 +00:00
[xtext][xtext] Prevent another IOOBE in XtextLinkingService
This commit is contained in:
parent
c6e9930e7a
commit
381b91666d
1 changed files with 5 additions and 3 deletions
|
@ -109,9 +109,11 @@ public class XtextLinkingService extends DefaultLinkingService {
|
|||
ClasspathUriUtil.CLASSPATH_SCHEME + ":/" + grammarName.replace('.', '/') + "." + fileExtension);
|
||||
URI normalizedURI = resourceSet.getURIConverter().normalize(classpathURI);
|
||||
final Resource resource = resourceSet.getResource(normalizedURI, true);
|
||||
final Grammar usedGrammar = (Grammar) resource.getContents().get(0);
|
||||
if (grammarName.equals(usedGrammar.getName()))
|
||||
return Collections.<EObject>singletonList(usedGrammar);
|
||||
if (!resource.getContents().isEmpty()) {
|
||||
final Grammar usedGrammar = (Grammar) resource.getContents().get(0);
|
||||
if (grammarName.equals(usedGrammar.getName()))
|
||||
return Collections.<EObject>singletonList(usedGrammar);
|
||||
}
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue