Bläddra i källkod

Fix segfault in readln()

This could be reproduced simply by doing: [TAB] and backspacing
a few times.
master
sin 10 år sedan
förälder
incheckning
cfd530b167
1 ändrade filer med 7 tillägg och 2 borttagningar
  1. +7
    -2
      noice.c

+ 7
- 2
noice.c Visa fil

@@ -287,8 +287,13 @@ readln(void)
if (c == KEY_BACKSPACE) {
getyx(stdscr, y, x);
if (x >= x0) {
ln = realloc(ln, (i - 1) * sizeof(*ln));
i--;
if (i > 0) {
ln = realloc(ln, (i - 1) * sizeof(*ln));
i--;
} else {
free(ln);
ln = NULL;
}
move(y, x);
printw("%c", ' ');
move(y, x);


Laddar…
Avbryt
Spara