summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2013-07-06 13:34:10 +0200
committerDavid Tardon <dtardon@redhat.com>2013-07-06 13:34:17 +0200
commit73a17a5730bfbfb738cf0fa4fe59ad4b478f9731 (patch)
tree97cfcee92174eada9b506e7e4af232519b426eb3
parent6fe924aae90c7aed8a3ad6e172a90a341f7a82ca (diff)
coverity: gmtime can return NULL
-rw-r--r--src/lib/VSDFieldList.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/VSDFieldList.cpp b/src/lib/VSDFieldList.cpp
index 20c1759..d7efe29 100644
--- a/src/lib/VSDFieldList.cpp
+++ b/src/lib/VSDFieldList.cpp
@@ -74,8 +74,12 @@ WPXString libvisio::VSDNumericField::datetimeToString(const char *format, double
WPXString result;
char buffer[MAX_BUFFER];
time_t timer = (time_t)(86400 * datetime - 2209161600.0);
- strftime(&buffer[0], MAX_BUFFER-1, format, gmtime(&timer));
- result.append(&buffer[0]);
+ const struct tm *const time = gmtime(&timer);
+ if (time)
+ {
+ strftime(&buffer[0], MAX_BUFFER-1, format, time);
+ result.append(&buffer[0]);
+ }
return result;
}