From 59d40f4146d2e434ce71c8bfb836104545cdf89d Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 15 May 2019 17:08:01 -0700 Subject: [PATCH] libsysprof: better empty check --- src/libsysprof/sysprof-callgraph-profile.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libsysprof/sysprof-callgraph-profile.c b/src/libsysprof/sysprof-callgraph-profile.c index 7caa5b8f..72a55964 100644 --- a/src/libsysprof/sysprof-callgraph-profile.c +++ b/src/libsysprof/sysprof-callgraph-profile.c @@ -514,14 +514,18 @@ sysprof_callgraph_profile_get_stash (SysprofCallgraphProfile *self) gboolean sysprof_callgraph_profile_is_empty (SysprofCallgraphProfile *self) { + StackNode *root; + g_return_val_if_fail (SYSPROF_IS_CALLGRAPH_PROFILE (self), FALSE); - return self->stash == NULL; + return (self->stash == NULL || + !(root = stack_stash_get_root (self->stash)) || + !root->total); } GQuark sysprof_callgraph_profile_get_tag (SysprofCallgraphProfile *self, - const gchar *symbol) + const gchar *symbol) { g_return_val_if_fail (SYSPROF_IS_CALLGRAPH_PROFILE (self), 0);