From 85a3c08c0496a22a01ea12aff9fdc959356e8b37 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 1 Jan 2012 04:24:45 -0600 Subject: [PATCH] Fix potential crash --- cmake | 2 +- kfile-plugins/elf/kfile_elf.cpp | 18 ++++++++++-------- kio/kio/kfileitem.cpp | 14 ++++++++------ kio/kio/kurifilter.cpp | 14 ++++++++------ 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/cmake b/cmake index 6092ca3fd..42b03b096 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 6092ca3fd1c345a94e4b634bc1a6370f735bcfd7 +Subproject commit 42b03b0965a9e958b6007b49201b7793d2bd4f65 diff --git a/kfile-plugins/elf/kfile_elf.cpp b/kfile-plugins/elf/kfile_elf.cpp index f816cdb35..73c30203c 100644 --- a/kfile-plugins/elf/kfile_elf.cpp +++ b/kfile-plugins/elf/kfile_elf.cpp @@ -135,15 +135,17 @@ bool KElfPlugin::readInfo( KFileMetaInfo& info, uint what) { // Failed to obtain a list of ELF icons } - while((entry = get_nexticon(&icons, entry)) != NULL) - { - if (iconListing.isEmpty()) { - iconListing = entry->name; - } - else { - iconListing = iconListing.append("

").append(entry->name); + else { + while((entry = get_nexticon(&icons, entry)) != NULL) + { + if (iconListing.isEmpty()) { + iconListing = entry->name; + } + else { + iconListing = iconListing.append("

").append(entry->name); + } + break; } - break; } if (iconListing.isEmpty()) { iconListing = TQString("") + i18n("not set") + TQString(""); diff --git a/kio/kio/kfileitem.cpp b/kio/kio/kfileitem.cpp index e74b407be..38e3c0e3c 100644 --- a/kio/kio/kfileitem.cpp +++ b/kio/kio/kfileitem.cpp @@ -674,12 +674,14 @@ TQPixmap KFileItem::pixmap( int _size, int _state ) const { // Failed to obtain a list of ELF icons } - while((entry = get_nexticon(&icons, entry)) != NULL) - { - if (KGlobal::iconLoader()->iconPath(entry->name, 0, true) != "") { - iconresnamefound = 1; - p = DesktopIcon( entry->name, _size, _state ); - break; + else { + while((entry = get_nexticon(&icons, entry)) != NULL) + { + if (KGlobal::iconLoader()->iconPath(entry->name, 0, true) != "") { + iconresnamefound = 1; + p = DesktopIcon( entry->name, _size, _state ); + break; + } } } diff --git a/kio/kio/kurifilter.cpp b/kio/kio/kurifilter.cpp index f6910e6a1..f16e0db7d 100644 --- a/kio/kio/kurifilter.cpp +++ b/kio/kio/kurifilter.cpp @@ -222,12 +222,14 @@ TQString KURIFilterData::iconName() { // Failed to obtain a list of ELF icons } - while((entry = get_nexticon(&icons, entry)) != NULL) - { - if (KGlobal::iconLoader()->iconPath(entry->name, 0, true) != "") { - iconresnamefound = 1; - m_strIconName = entry->name; - break; + else { + while((entry = get_nexticon(&icons, entry)) != NULL) + { + if (KGlobal::iconLoader()->iconPath(entry->name, 0, true) != "") { + iconresnamefound = 1; + m_strIconName = entry->name; + break; + } } }