diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2014-04-12 21:45:27 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2014-04-12 21:45:27 +0200 |
commit | 001ea53f9de524bee480cdd3996b1c9e10b2d568 (patch) | |
tree | d5261592e646093e97c30e240cb2bb8418d0fc9d /src/core | |
parent | 7618fdd240e32292b2202c76550c67f09ee0d90e (diff) | |
download | weechat-001ea53f9de524bee480cdd3996b1c9e10b2d568.zip |
core: fix crash on "weechat --upgrade" if no .upgrade files are found
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/wee-upgrade-file.c | 3 | ||||
-rw-r--r-- | src/core/wee-upgrade.c | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/core/wee-upgrade-file.c b/src/core/wee-upgrade-file.c index 2048fbfbe..08088f223 100644 --- a/src/core/wee-upgrade-file.c +++ b/src/core/wee-upgrade-file.c @@ -780,5 +780,6 @@ upgrade_file_read (struct t_upgrade_file *upgrade_file, void upgrade_file_close (struct t_upgrade_file *upgrade_file) { - fclose (upgrade_file->file); + if (upgrade_file && upgrade_file->file) + fclose (upgrade_file->file); } diff --git a/src/core/wee-upgrade.c b/src/core/wee-upgrade.c index 01fc52ab3..b9d9c0e72 100644 --- a/src/core/wee-upgrade.c +++ b/src/core/wee-upgrade.c @@ -775,6 +775,8 @@ upgrade_weechat_load () upgrade_layout = gui_layout_alloc (GUI_LAYOUT_UPGRADE); upgrade_file = upgrade_file_new (WEECHAT_UPGRADE_FILENAME, 0); + if (!upgrade_file) + return 0; rc = upgrade_file_read (upgrade_file, &upgrade_weechat_read_cb, NULL); upgrade_file_close (upgrade_file); |