Skip to content

Commit a683aa8

Browse files
committed
avoid NPEs when no selection
1 parent 2e0411c commit a683aa8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

app/src/processing/app/ui/Editor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2222,7 +2222,7 @@ public void handleIndentOutdent(boolean indent) {
22222222
int last = Math.min(location + tabSize, textarea.getDocumentLength());
22232223
textarea.select(location, last);
22242224
// Don't eat code if it's not indented
2225-
if (textarea.getSelectedText().equals(tabString)) {
2225+
if (tabString.equals(textarea.getSelectedText())) {
22262226
textarea.setSelectedText("");
22272227
}
22282228
}
@@ -2321,11 +2321,11 @@ protected void handleFindReference() {
23212321
if (ref != null) {
23222322
showReference(ref + ".html");
23232323
} else {
2324-
String text = textarea.getSelectedText().trim();
2325-
if (text.length() == 0) {
2324+
String text = textarea.getSelectedText();
2325+
if (text == null) {
23262326
statusNotice(Language.text("editor.status.find_reference.select_word_first"));
23272327
} else {
2328-
statusNotice(Language.interpolate("editor.status.find_reference.not_available", text));
2328+
statusNotice(Language.interpolate("editor.status.find_reference.not_available", text.trim()));
23292329
}
23302330
}
23312331
}

0 commit comments

Comments
 (0)