summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2014-04-12 21:45:27 +0200
committerSébastien Helleu <flashcode@flashtux.org>2014-04-12 21:45:27 +0200
commit001ea53f9de524bee480cdd3996b1c9e10b2d568 (patch)
treed5261592e646093e97c30e240cb2bb8418d0fc9d
parent7618fdd240e32292b2202c76550c67f09ee0d90e (diff)
downloadweechat-001ea53f9de524bee480cdd3996b1c9e10b2d568.zip
core: fix crash on "weechat --upgrade" if no .upgrade files are found
-rw-r--r--src/core/wee-upgrade-file.c3
-rw-r--r--src/core/wee-upgrade.c2
-rw-r--r--src/plugins/irc/irc-upgrade.c2
-rw-r--r--src/plugins/relay/relay-upgrade.c2
-rw-r--r--src/plugins/xfer/xfer-upgrade.c2
5 files changed, 10 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);
diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c
index 9f3b62e25..927dd151c 100644
--- a/src/plugins/irc/irc-upgrade.c
+++ b/src/plugins/irc/irc-upgrade.c
@@ -720,6 +720,8 @@ irc_upgrade_load ()
irc_upgrade_set_buffer_callbacks ();
upgrade_file = weechat_upgrade_new (IRC_UPGRADE_FILENAME, 0);
+ if (!upgrade_file)
+ return 0;
rc = weechat_upgrade_read (upgrade_file, &irc_upgrade_read_cb, NULL);
weechat_upgrade_close (upgrade_file);
diff --git a/src/plugins/relay/relay-upgrade.c b/src/plugins/relay/relay-upgrade.c
index b6a94f511..f82854d07 100644
--- a/src/plugins/relay/relay-upgrade.c
+++ b/src/plugins/relay/relay-upgrade.c
@@ -240,6 +240,8 @@ relay_upgrade_load ()
relay_upgrade_set_buffer_callbacks ();
upgrade_file = weechat_upgrade_new (RELAY_UPGRADE_FILENAME, 0);
+ if (!upgrade_file)
+ return 0;
rc = weechat_upgrade_read (upgrade_file, &relay_upgrade_read_cb, NULL);
weechat_upgrade_close (upgrade_file);
diff --git a/src/plugins/xfer/xfer-upgrade.c b/src/plugins/xfer/xfer-upgrade.c
index 9e9c1f26d..8e9fed097 100644
--- a/src/plugins/xfer/xfer-upgrade.c
+++ b/src/plugins/xfer/xfer-upgrade.c
@@ -137,6 +137,8 @@ xfer_upgrade_load ()
xfer_upgrade_set_buffer_callbacks ();
upgrade_file = weechat_upgrade_new (XFER_UPGRADE_FILENAME, 0);
+ if (!upgrade_file)
+ return 0;
rc = weechat_upgrade_read (upgrade_file, &xfer_upgrade_read_cb, NULL);
weechat_upgrade_close (upgrade_file);