summaryrefslogtreecommitdiff
path: root/package/busybox/patches/480-vi_search.patch
blob: 1281135d2b51ec44b513141de50f9b4e493d9a27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -3317,7 +3317,7 @@ static void do_cmd(char c)
 		buf[1] = '\0';
 		q = get_input_line(buf);	// get input line- use "status line"
 		if (q[0] && !q[1]) {
-			if (last_search_pattern[0])
+			if (last_search_pattern)
 				last_search_pattern[0] = c;
 			goto dc3; // if no pat re-use old pat
 		}
@@ -3333,6 +3333,10 @@ static void do_cmd(char c)
 		if (cmdcnt-- > 1) {
 			do_cmd(c);
 		}				// repeat cnt
+		if (last_search_pattern == 0) {
+			msg = "No previous regular expression";
+			goto dc2;
+		}
 		dir = BACK;		// assume BACKWARD search
 		p = dot - 1;
 		if (last_search_pattern[0] == '?') {