Skip to content

Commit 492f709

Browse files
dschogitster
authored andcommitted
Work around a regression in Windows 7, causing erase_in_line() to crash sometimes
The function FillConsoleOutputCharacterA() was pretty content in XP to take a NULL pointer if we did not want to store the number of written columns. In Windows 7, it crashes, but only when called from within Git Bash, not from within cmd.exe. Go figure. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Steffen Prohaska <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 900a5d0 commit 492f709

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compat/winansi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,15 @@ static void set_console_attr(void)
8080
static void erase_in_line(void)
8181
{
8282
CONSOLE_SCREEN_BUFFER_INFO sbi;
83+
DWORD dummy; /* Needed for Windows 7 (or Vista) regression */
8384

8485
if (!console)
8586
return;
8687

8788
GetConsoleScreenBufferInfo(console, &sbi);
8889
FillConsoleOutputCharacterA(console, ' ',
8990
sbi.dwSize.X - sbi.dwCursorPosition.X, sbi.dwCursorPosition,
90-
NULL);
91+
&dummy);
9192
}
9293

9394

0 commit comments

Comments
 (0)