summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cd1663f)
raw | patch | inline | side by side (parent: cd1663f)
author | Max Kellermann <max@duempel.org> | |
Tue, 18 Nov 2008 20:51:07 +0000 (21:51 +0100) | ||
committer | Max Kellermann <max@duempel.org> | |
Tue, 18 Nov 2008 20:51:07 +0000 (21:51 +0100) |
When calling browser_change_directory() before a filelist was set,
ncmpc would crash due to a NULL pointer dereference. This scenario is
not possible currently, since the open() method allocates the
filelist.
ncmpc would crash due to a NULL pointer dereference. This scenario is
not possible currently, since the open() method allocates the
filelist.
src/screen_browser.c | patch | blob | history |
diff --git a/src/screen_browser.c b/src/screen_browser.c
index a9ed379913edf8b5c31a382be2255f4ed4960057..bcf749ed7bd67ebd3322c84145e04afcaed364d5 100644 (file)
--- a/src/screen_browser.c
+++ b/src/screen_browser.c
} else
return false;
- old_path = g_strdup(browser->filelist->path);
+ if (browser->filelist != NULL) {
+ old_path = g_strdup(browser->filelist->path);
+ filelist_free(browser->filelist);
+ } else
+ old_path = NULL;
- filelist_free(browser->filelist);
browser->filelist = mpdclient_filelist_get(c, path);
#ifndef NCMPC_MINI
sync_highlights(c, browser->filelist);
#endif
- idx = filelist_find_directory(browser->filelist, old_path);
+ idx = old_path != NULL
+ ? filelist_find_directory(browser->filelist, old_path)
+ : -1;
g_free(old_path);
list_window_reset(browser->lw);