aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/termptyops.c
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2016-12-19 23:38:32 +0100
committerBoris Faure <billiob@gmail.com>2016-12-19 23:38:32 +0100
commit240a4a02d331c549b74867d83203406d5f803bc5 (patch)
treec34a816cd04fb1b51f729b281ed1822fb8d31d73 /src/bin/termptyops.c
parenttermptyesc: correctly handle tab forward. Closes T4992 (diff)
downloadterminology-240a4a02d331c549b74867d83203406d5f803bc5.tar.gz
termpty: fix potential NULL dereference. CID1367485
Diffstat (limited to 'src/bin/termptyops.c')
-rw-r--r--src/bin/termptyops.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c
index ff668cc..0a69ed2 100644
--- a/src/bin/termptyops.c
+++ b/src/bin/termptyops.c
@@ -267,9 +267,12 @@ termpty_clear_line(Termpty *ty, Termpty_Clear mode, int limit)
void
termpty_clear_tabs_on_screen(Termpty *ty)
{
- memset(ty->tabs, 0,
- DIV_ROUND_UP(ty->w, sizeof(unsigned int) * 8u)
- * sizeof(unsigned int));
+ if (ty->tabs)
+ {
+ memset(ty->tabs, 0,
+ DIV_ROUND_UP(ty->w, sizeof(unsigned int) * 8u)
+ * sizeof(unsigned int));
+ }
}