sb: fix error: applying zero offset to null pointer
Found by UndefinedBehaviorSanitizer
This commit is contained in:
parent
04a47e0e19
commit
c2c324c497
|
@ -146,7 +146,8 @@ ty_sb_lskip(struct ty_sb *sb, size_t len)
|
|||
else
|
||||
{
|
||||
/* buffer is empty, get rid of gap */
|
||||
sb->buf -= sb->gap;
|
||||
if (sb->buf)
|
||||
sb->buf -= sb->gap;
|
||||
sb->gap = 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue