diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2018-08-15 16:24:07 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2018-08-15 16:24:07 +0200 |
commit | ec5a5fd73f287a67d09e89618595bbdba8cb18fa (patch) | |
tree | 52511a527158aaaa2a7d6f65457265e2f1bd9730 /src | |
parent | f10578b18b5a6bbbba451286a1d4322b41adf237 (diff) | |
download | weechat-ec5a5fd73f287a67d09e89618595bbdba8cb18fa.zip |
core: fix use of NULL pointer in command /buffer when the GUI is not yet initialized
Diffstat (limited to 'src')
-rw-r--r-- | src/core/wee-command.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c index c76f4be92..7bacb73d5 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -1192,9 +1192,10 @@ COMMAND_CALLBACK(buffer) if (!ptr_buffer->hidden) break; } - gui_buffer_switch_by_number (gui_current_window, - (ptr_buffer) ? - ptr_buffer->number : gui_buffers->number); + number = (ptr_buffer) ? + ptr_buffer->number : ((gui_buffers) ? gui_buffers->number : -1); + if (number > 0) + gui_buffer_switch_by_number (gui_current_window, number); } else { @@ -1261,9 +1262,10 @@ COMMAND_CALLBACK(buffer) if (!ptr_buffer->hidden) break; } - gui_buffer_switch_by_number (gui_current_window, - (ptr_buffer) ? - ptr_buffer->number : last_gui_buffer->number); + number = (ptr_buffer) ? + ptr_buffer->number : ((last_gui_buffer) ? last_gui_buffer->number : -1); + if (number > 0) + gui_buffer_switch_by_number (gui_current_window, number); } else { |