From 67b97d1b9212e9266d0c1809882e603bafaa5be9 Mon Sep 17 00:00:00 2001 From: louis Date: Fri, 6 Dec 2013 16:19:56 +0100 Subject: fixed a bug in cImageLoader::FirstImageInFolder() --- HISTORY | 5 +++++ imageloader.c | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/HISTORY b/HISTORY index 219b11a..0088052 100644 --- a/HISTORY +++ b/HISTORY @@ -383,3 +383,8 @@ Version 1.0.0 - fixed a crash with dvb cards which deliver negative signal values - added theme darkredNG - updated ca_es po file + +Version 1.0.1 + +- fixed a bug in cImageLoader::FirstImageInFolder() + diff --git a/imageloader.c b/imageloader.c index c368370..047502b 100644 --- a/imageloader.c +++ b/imageloader.c @@ -153,12 +153,12 @@ bool cImageLoader::FirstImageInFolder(cString Path, cString Extension, cString * while (file = readdir(folder)) { if (endswith(file->d_name, *Extension)) { std::string fileName = file->d_name; - if (!fileName.compare(fileName.size()-8, 8, "_vdr.jpg")) + int strlen = fileName.length(); + if (strlen < 8) continue; - if (fileName.length() > 4) - fileName = fileName.substr(0, fileName.length() - 4); - else - return false; + if (!fileName.compare(strlen-8, 8, "_vdr.jpg")) + continue; + fileName = fileName.substr(0, strlen - 4); *recImage = fileName.c_str(); return true; } -- cgit v1.2.3