changeset 15538:31ed1f5cc8f1

stats: Fixed crash when handling multiple users within same process.
author Timo Sirainen <tss@iki.fi>
date Wed, 28 Nov 2012 04:21:03 +0200
parents 348e9bad84f0
children c81f1ca3cda6
files src/plugins/stats/stats-plugin.c
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/stats/stats-plugin.c	Wed Nov 28 03:56:06 2012 +0200
+++ b/src/plugins/stats/stats-plugin.c	Wed Nov 28 04:21:03 2012 +0200
@@ -587,9 +587,13 @@
 		stats_global_user = user;
 	} else if (stats_user_count == 1) {
 		/* second user connection. we'll need to start doing
-		   per-io callback tracking now. */
-		stats_add_session(stats_global_user);
-		stats_global_user = NULL;
+		   per-io callback tracking now. (we might have been doing it
+		   also previously but just temporarily quickly dropped to
+		   having 1 user, in which case stats_global_user=NULL) */
+		if (stats_global_user != NULL) {
+			stats_add_session(stats_global_user);
+			stats_global_user = NULL;
+		}
 	}
 	stats_user_count++;