termpty: fix potential NULL dereference. CID1367485

This commit is contained in:
Boris Faure 2016-12-19 23:38:32 +01:00
parent b9d5a55aa4
commit 240a4a02d3
1 changed files with 6 additions and 3 deletions

View File

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