diff --git a/modules/libcom/src/error/errlog.c b/modules/libcom/src/error/errlog.c index bd6d1c45d..2bd8d7676 100644 --- a/modules/libcom/src/error/errlog.c +++ b/modules/libcom/src/error/errlog.c @@ -247,7 +247,7 @@ int isATTY(FILE* fp) else if(fp==stderr) hand = GetStdHandle(STD_ERROR_HANDLE); #ifdef ENABLE_VIRTUAL_TERMINAL_PROCESSING - if(hand && GetConsoleMode(hand, &mode)) { + if(hand!=INVALID_HANDLE_VALUE && GetConsoleMode(hand, &mode)) { (void)SetConsoleMode(hand, mode|ENABLE_VIRTUAL_TERMINAL_PROCESSING); mode = 0u; if(GetConsoleMode(hand, &mode) && (mode&ENABLE_VIRTUAL_TERMINAL_PROCESSING))