mirror of
https://github.com/cage-kiosk/cage.git
synced 2026-02-24 01:40:32 -05:00
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:
parent
a9a8f551e5
commit
2543934055
1 changed files with 3 additions and 0 deletions
3
view.c
3
view.c
|
|
@ -28,6 +28,9 @@ char *
|
||||||
view_get_title(struct cg_view *view)
|
view_get_title(struct cg_view *view)
|
||||||
{
|
{
|
||||||
const char *title = view->impl->get_title(view);
|
const char *title = view->impl->get_title(view);
|
||||||
|
if (!title) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return strndup(title, strlen(title));
|
return strndup(title, strlen(title));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue