view_get_title: add NULL check

Otherwise, we'll segfault:

0x00007ffff7c36715 in __strlen_avx2 () at /usr/lib/libc.so.6
0x000055555555ae00 in view_get_title (view=0x5555558403c0) at ../view.c:34
This commit is contained in:
Jente Hidskes 2019-01-31 16:20:48 +01:00
parent a9a8f551e5
commit 2543934055
No known key found for this signature in database
GPG key ID: 04BE5A29F32D91EA

3
view.c
View file

@ -28,6 +28,9 @@ char *
view_get_title(struct cg_view *view)
{
const char *title = view->impl->get_title(view);
if (!title) {
return NULL;
}
return strndup(title, strlen(title));
}