summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--osdep/terminal-win.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/osdep/terminal-win.c b/osdep/terminal-win.c
index 27740f9be3..e19f7dbe96 100644
--- a/osdep/terminal-win.c
+++ b/osdep/terminal-win.c
@@ -304,8 +304,11 @@ void mp_write_console_ansi(HANDLE wstream, char *buf)
attr |= stdoutAttrs & BACKGROUND_ALL;
} else if (p == 38 || p == 48) { // ignore and skip sub-values
// 256 colors: <38/48>;5;N true colors: <38/48>;2;R;G;B
- if (n+1 < num_params)
- n += params[n+1] == 5 ? 2 : 2 ? 4 : 0;
+ if (n+1 < num_params) {
+ n += params[n+1] == 5 ? 2
+ : params[n+1] == 2 ? 4
+ : num_params; /* unrecognized -> the rest */
+ }
}
}