Parcourir la source

Fix segfault in readln()

This could be reproduced simply by doing: [TAB] and backspacing
a few times.
master
sin il y a 10 ans
Parent
révision
cfd530b167
1 fichiers modifiés avec 7 ajouts et 2 suppressions
  1. +7
    -2
      noice.c

+ 7
- 2
noice.c Voir le fichier

@@ -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);


Chargement…
Annuler
Enregistrer