From 4f8f8fcb52d1d1f2a46468aa6bb4a8da11804c5b Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Sun, 8 Nov 2015 17:19:21 +0100 Subject: [PATCH] report: add extra pointer check Coverity was seeing possible trouble with NULL pointer dereference. So ensure it may never happen. --- lib/report/report.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/report/report.c b/lib/report/report.c index 911c96eff..91522b10b 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -960,13 +960,13 @@ static int _translate_time_items(struct dm_report *rh, struct time_info *info, t += (multiplier * SECS_PER_HOUR); break; case TIME_UNIT_AM: - if (ti_p->prop->id == TIME_NUM_MULTIPLIER) + if (ti_p && ti_p->prop->id == TIME_NUM_MULTIPLIER) tm.tm_hour = multiplier; break; case TIME_UNIT_PM: - if (_is_time_unit(ti_p->prop->id)) + if (ti_p && _is_time_unit(ti_p->prop->id)) t -= 12 * SECS_PER_HOUR; - else if (ti_p->prop->id == TIME_NUM_MULTIPLIER) + else if (ti_p && ti_p->prop->id == TIME_NUM_MULTIPLIER) tm.tm_hour = multiplier + 12; break; case TIME_UNIT_DAY: