awecz / jsyntaxpane

Automatically exported from code.google.com/p/jsyntaxpane
0 stars 0 forks source link

"Find next" bug when no searches have been performed #182

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Open an editor
2. Invoke find-next action
3. Dialog pops up saying "null" can't be found

What is the expected output? What do you see instead?

No searches have yet been performed, so nothing should happen (or *perhaps* a 
dialog saying "nothing to search for")

What version of the product are you using? On what operating system?

This applies to jsyntaxpane-0.9.5

Please provide any additional information below.

Here is a patch that simply ignores the action if no search has yet been 
performed:

--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -17,7 +17,8 @@
     public void actionPerformed(JTextComponent target, SyntaxDocument sdoc,
             int dot, ActionEvent e) {
         DocumentSearchData dsd = DocumentSearchData.getFromEditor(target);
-        if (dsd != null) {
+
+        if (dsd != null && dsd.getPattern() != null) {
             if(!dsd.doFindNext(target)) {
                dsd.msgNotFound(target);
            }

Original issue reported on code.google.com by Gabriel....@gmail.com on 6 Mar 2012 at 3:19