core: fix crash on "weechat --upgrade" if no .upgrade files are found

This commit is contained in:
Sébastien Helleu 2014-04-12 21:45:27 +02:00
parent 7618fdd240
commit 001ea53f9d
5 changed files with 10 additions and 1 deletions

View File

@ -780,5 +780,6 @@ upgrade_file_read (struct t_upgrade_file *upgrade_file,
void
upgrade_file_close (struct t_upgrade_file *upgrade_file)
{
if (upgrade_file && upgrade_file->file)
fclose (upgrade_file->file);
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);