diff --git a/src/search/FindReplace.js b/src/search/FindReplace.js
index <HASH>..<HASH> 100644
--- a/src/search/FindReplace.js
+++ b/src/search/FindReplace.js
@@ -398,10 +398,10 @@ define(function (require, exports, module) {
         var cm = editor._codeMirror;
         cm.operation(function () {
             var nextMatch = _getNextMatch(editor, rev, pos);
-            if (!nextMatch) {
-                cm.setCursor(editor.getCursorPos());  // collapses selection, keeping cursor in place to avoid scrolling
-            } else {
+            if (nextMatch) {
                 _selectAndScrollTo(editor, [nextMatch], true, preferNoScroll);
+            } else {
+                cm.setCursor(editor.getCursorPos());  // collapses selection, keeping cursor in place to avoid scrolling
             }
         });
     }
Clean up double-negative if statement