Mercurial > hg > forks > geeqie
changeset 2459:81ba6aa8467c
Bug fix: Seg fault in copy/move dialog
If a non-existant folder is entered as the destination in a copy/move
operation, Geeqie will crash.
Check for NULL returned from registered_extension_from_path()
author | Colin Clark <cclark@mcb.net> |
---|---|
date | Wed, 22 Mar 2017 14:33:48 +0000 |
parents | 46817a8b4fbd |
children | 7c6eccb3aea8 |
files | src/ui_fileops.c |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ui_fileops.c Wed Mar 22 10:13:03 2017 +0000 +++ b/src/ui_fileops.c Wed Mar 22 14:33:48 2017 +0000 @@ -757,8 +757,13 @@ gchar *remove_extension_from_path(const gchar *path) { + const gchar *reg_ext; + if (!path) return NULL; - return g_strndup(path, strlen(path)-strlen(registered_extension_from_path(path))); + + reg_ext = registered_extension_from_path(path); + + return g_strndup(path, strlen(path) - (reg_ext == NULL ? 0 : strlen(reg_ext))); } void parse_out_relatives(gchar *path)