瀏覽代碼

Additional pointer check

Serj Kalichev 10 年之前
父節點
當前提交
f05ade5e41
共有 1 個文件被更改,包括 1 次插入1 次删除
  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);