summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonsta <[email protected]>2015-08-21 19:10:02 +0300
committermonsta <[email protected]>2015-09-01 13:10:22 +0300
commit40d39b877c5ac96e54b80d170736ca526353aaed (patch)
tree796a943797aad624ae963f75f2d05e3bcc7d4b85
parent25a7c643d44b7d5c858e2b24b1bd7679777eabb8 (diff)
downloadmate-utils-40d39b877c5ac96e54b80d170736ca526353aaed.tar.bz2
mate-utils-40d39b877c5ac96e54b80d170736ca526353aaed.tar.xz
logview: add some safety NULL-checks
from https://git.gnome.org/browse/gnome-system-log/commit/?id=ad9153b8bcd8a2556d7a1f5fcca890680c4677de
-rw-r--r--logview/logview-loglist.c11
-rw-r--r--logview/logview-manager.c4
2 files changed, 11 insertions, 4 deletions
diff --git a/logview/logview-loglist.c b/logview/logview-loglist.c
index d7945c64..3bd0c8aa 100644
--- a/logview/logview-loglist.c
+++ b/logview/logview-loglist.c
@@ -135,7 +135,8 @@ logview_loglist_find_log (LogviewLoglist *list, LogviewLog *log)
if (current == log) {
retval = gtk_tree_iter_copy (&iter);
}
- g_object_unref (current);
+ if (current)
+ g_object_unref (current);
} while (gtk_tree_model_iter_next (model, &iter) != FALSE && retval == NULL);
return retval;
@@ -488,10 +489,12 @@ logview_loglist_update_lines (LogviewLoglist *loglist, LogviewLog *log)
g_assert (LOGVIEW_IS_LOGLIST (loglist));
g_assert (LOGVIEW_IS_LOG (log));
- days = logview_log_get_days_for_cached_lines (log);
parent = logview_loglist_find_log (loglist, log);
- update_days_and_lines_for_log (loglist, parent, days);
- gtk_tree_iter_free (parent);
+ if (parent) {
+ days = logview_log_get_days_for_cached_lines (log);
+ update_days_and_lines_for_log (loglist, parent, days);
+ gtk_tree_iter_free (parent);
+ }
}
diff --git a/logview/logview-manager.c b/logview/logview-manager.c
index 6d6bfb05..2448468e 100644
--- a/logview/logview-manager.c
+++ b/logview/logview-manager.c
@@ -393,6 +393,10 @@ logview_manager_close_active_log (LogviewManager *manager)
g_assert (LOGVIEW_IS_MANAGER (manager));
active_log = manager->priv->active_log;
+ if (active_log == NULL) {
+ return;
+ }
+
log_uri = logview_log_get_uri (active_log);
file = logview_log_get_gfile (active_log);