mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Merge pull request #1772 from MarcoPolo-PasTonMolo/fix/segfault-mam
Fix segfault when loading from MAM
This commit is contained in:
commit
debc73c474
@ -2056,9 +2056,20 @@ win_redraw(ProfWin* window)
|
|||||||
void
|
void
|
||||||
win_print_loading_history(ProfWin* window)
|
win_print_loading_history(ProfWin* window)
|
||||||
{
|
{
|
||||||
GDateTime* timestamp = buffer_size(window->layout->buffer) != 0 ? buffer_get_entry(window->layout->buffer, 0)->time : g_date_time_new_now_local();
|
GDateTime* timestamp;
|
||||||
|
gboolean is_buffer_empty = buffer_size(window->layout->buffer) == 0;
|
||||||
|
|
||||||
|
if (!is_buffer_empty) {
|
||||||
|
timestamp = buffer_get_entry(window->layout->buffer, 0)->time;
|
||||||
|
} else {
|
||||||
|
timestamp = g_date_time_new_now_local();
|
||||||
|
}
|
||||||
|
|
||||||
buffer_prepend(window->layout->buffer, "-", 0, timestamp, NO_DATE, THEME_ROOMINFO, NULL, NULL, LOADING_MESSAGE, NULL, NULL);
|
buffer_prepend(window->layout->buffer, "-", 0, timestamp, NO_DATE, THEME_ROOMINFO, NULL, NULL, LOADING_MESSAGE, NULL, NULL);
|
||||||
g_date_time_unref(timestamp);
|
|
||||||
|
if (is_buffer_empty)
|
||||||
|
g_date_time_unref(timestamp);
|
||||||
|
|
||||||
win_redraw(window);
|
win_redraw(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user