aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbb/termios.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/libbb/termios.c b/libbb/termios.c
index 5695e9ba2..c05bb6dbb 100644
--- a/libbb/termios.c
+++ b/libbb/termios.c
@@ -226,11 +226,9 @@ static int get_wincon_width_height(const int fd, int *width, int *height)
226 CONSOLE_SCREEN_BUFFER_INFO sbi; 226 CONSOLE_SCREEN_BUFFER_INFO sbi;
227 227
228 console = GetStdHandle(STD_OUTPUT_HANDLE); 228 console = GetStdHandle(STD_OUTPUT_HANDLE);
229 if (console == INVALID_HANDLE_VALUE || !console) 229 if (console == INVALID_HANDLE_VALUE || !console || !GetConsoleScreenBufferInfo(console, &sbi))
230 return -1; 230 return -1;
231 231
232 GetConsoleScreenBufferInfo(console, &sbi);
233
234 if (width) 232 if (width)
235 *width = sbi.srWindow.Right - sbi.srWindow.Left; 233 *width = sbi.srWindow.Right - sbi.srWindow.Left;
236 if (height) 234 if (height)