iolog: fix --bandwidth-log segfaults
[fio.git] / stat.c
diff --git a/stat.c b/stat.c
index 3c72a6cd8a140b5fe0b81cb9d65d7dc1329a2dfb..1e889f537f24254cc9090a103a1993cf1a18e09d 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -2023,7 +2023,7 @@ static void __add_log_sample(struct io_log *iolog, unsigned long val,
                s = get_sample(iolog, cur_log, cur_log->nr_samples);
 
                s->val = val;
-               s->time = t + iolog->td->unix_epoch;
+               s->time = t + (iolog->td ? iolog->td->unix_epoch : 0);
                io_sample_set_ddir(iolog, s, ddir);
                s->bs = bs;