Explorar el Código

Additional pointer check

Serj Kalichev hace 10 años
padre
commit
f05ade5e41
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      tinyrl/tinyrl.c

+ 1 - 1
tinyrl/tinyrl.c

@@ -945,7 +945,7 @@ static char *internal_readline(tinyrl_t * this,
 		}
 		/* If the last character in the line (other than NULL)
 		   is a space remove it. */
-		if (this->end && isspace(this->line[this->end - 1]))
+		if (this->end && this->line && isspace(this->line[this->end - 1]))
 			tinyrl_delete_text(this, this->end - 1, this->end);
 		/* Restores the terminal mode */
 		tty_restore_mode(this);