Fixed segfault when cache is broken #213
This commit is contained in:
parent
39ac8366fe
commit
10c2a2a2d0
@ -1,4 +1,4 @@
|
|||||||
project('wofi', 'c', version : 'v1.4.1', default_options : ['c_std=c99', 'buildtype=release', 'warning_level=2'])
|
project('wofi', 'c', version : 'hg', default_options : ['c_std=c99', 'buildtype=release', 'warning_level=2'])
|
||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
|
|
||||||
pkgcfg = import('pkgconfig')
|
pkgcfg = import('pkgconfig')
|
||||||
|
11
src/wofi.c
11
src/wofi.c
@ -926,7 +926,16 @@ struct wl_list* wofi_read_cache(struct mode* mode) {
|
|||||||
smallest_node = node;
|
smallest_node = node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
char* tmp = strdup(strchr(smallest_node->line, ' ') + 1);
|
|
||||||
|
char* space = strchr(smallest_node->line, ' ');
|
||||||
|
|
||||||
|
if(space == NULL) {
|
||||||
|
free(smallest_node->line);
|
||||||
|
wl_list_remove(&smallest_node->link);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* tmp = strdup(space + 1);
|
||||||
free(smallest_node->line);
|
free(smallest_node->line);
|
||||||
smallest_node->line = tmp;
|
smallest_node->line = tmp;
|
||||||
wl_list_remove(&smallest_node->link);
|
wl_list_remove(&smallest_node->link);
|
||||||
|
Loading…
Reference in New Issue
Block a user