diff --git a/src/vte.cc b/src/vte.cc
index 48a3047..386f605 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -4443,6 +4443,7 @@ _vte_terminal_check_noecho(VteTerminal *terminal)
 {
         struct termios t;
         gboolean new_noecho;
+        if (terminal->pvt->pty == NULL) return;
         if (tcgetattr(vte_pty_get_fd(terminal->pvt->pty), &t) != 0) return;
         new_noecho = ((t.c_lflag & ICANON) && !(t.c_lflag & ECHO));
         if (new_noecho != terminal->pvt->noecho) {
