- fix AssetCompletionProvider exception on blank lines

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10121 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 12 years ago
parent 28bb74fa95
commit 9b1e2819a9
  1. 9
      sdk/jme3-core/src/com/jme3/gde/core/completion/AssetCompletionProvider.java

@ -110,7 +110,6 @@ public class AssetCompletionProvider implements CompletionProvider {
completionResultSet.finish();
return;
}
AssetType type = determineType(document, caretOffset);
String filter = null;
int startOffset = caretOffset - 1;
try {
@ -118,7 +117,12 @@ public class AssetCompletionProvider implements CompletionProvider {
final int lineStartOffset = getRowFirstNonWhite(bDoc, caretOffset);
final char[] line = bDoc.getText(lineStartOffset, caretOffset - lineStartOffset).toCharArray();
final int whiteOffset = indexOfInsertion(line);
filter = new String(line, whiteOffset + 1, line.length - whiteOffset - 1);
int end = line.length - whiteOffset - 1;
if (end < 0) {
completionResultSet.finish();
return;
}
filter = new String(line, whiteOffset + 1, end);
if (whiteOffset > 0) {
startOffset = lineStartOffset + whiteOffset + 1;
} else {
@ -128,6 +132,7 @@ public class AssetCompletionProvider implements CompletionProvider {
Exceptions.printStackTrace(ex);
}
logger.log(Level.FINE, "Searching with filter {0}", filter);
AssetType type = determineType(document, caretOffset);
switch (type) {
case Model:
for (String string : manager.getModels()) {

Loading…
Cancel
Save