Skip to content

Commit 0318efc

Browse files
committed
Fix situation in which we don't get an full result from terminal.
Don't crash if the color information is not complete yet. Can happen in particular on slow ssh connections.
1 parent 2d58cdf commit 0318efc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/term-query.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ const char *QueryBackgroundColor() {
202202
// We might've gotten some spurious bytes in the beginning from
203203
// keypresses, so find where the color starts.
204204
const char *found = find_str(data, len, "rgb:");
205-
return strchr(found, '\\') ? found : nullptr;
205+
return found && strchr(found, '\\') ? found : nullptr;
206206
});
207207

208208
if (!start_color) return nullptr;

0 commit comments

Comments
 (0)