aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r--qt-ui/divelistview.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index 014f00583..43f0b1c38 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -804,7 +804,6 @@ void DiveListView::loadImages()
{
struct memblock mem;
EXIFInfo exif;
- int code;
time_t imagetime;
QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Open Image Files"), lastUsedImageDir(), tr("Image Files (*.jpg *.jpeg *.pnm *.tif *.tiff)"));
@@ -819,9 +818,13 @@ void DiveListView::loadImages()
for (int i = 0; i < fileNames.size(); ++i) {
struct tm tm;
int year, month, day, hour, min, sec;
- readfile(fileNames.at(i).toUtf8().data(), &mem);
- code = exif.parseFrom((const unsigned char *) mem.buffer, (unsigned) mem.size);
+ int retval;
+ if (readfile(fileNames.at(i).toUtf8().data(), &mem) <= 0)
+ continue;
+ retval = exif.parseFrom((const unsigned char *) mem.buffer, (unsigned) mem.size);
free(mem.buffer);
+ if (retval != PARSE_EXIF_SUCCESS)
+ continue;
sscanf(exif.DateTime.c_str(), "%d:%d:%d %d:%d:%d", &year, &month, &day, &hour, &min, &sec);
tm.tm_year = year;
tm.tm_mon = month - 1;