From 0b0fc72987436ffbce2ac96d8c163a063572897f Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 2 Jan 2012 03:24:06 -0600 Subject: [PATCH] Make elf icon reading more robust --- kio/kio/kfileitem.cpp | 5 +++++ kio/kio/kurifilter.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/kio/kio/kfileitem.cpp b/kio/kio/kfileitem.cpp index 38e3c0e3c..6207e66b9 100644 --- a/kio/kio/kfileitem.cpp +++ b/kio/kio/kfileitem.cpp @@ -659,6 +659,11 @@ TQPixmap KFileItem::pixmap( int _size, int _state ) const icon_size = _size; icon = libr_icon_geticon_bysize(handle, icon_size); if(icon == NULL) + { + // Try loading the first icon as fallback + icon = libr_icon_geticon_byid(handle, 0); + } + if(icon == NULL) { kdWarning() << "failed to obtain ELF icon: " << libr_errmsg() << endl; libr_close(handle); diff --git a/kio/kio/kurifilter.cpp b/kio/kio/kurifilter.cpp index f16e0db7d..d0f6425ad 100644 --- a/kio/kio/kurifilter.cpp +++ b/kio/kio/kurifilter.cpp @@ -206,6 +206,11 @@ TQString KURIFilterData::iconName() icon_size = 32; // FIXME: Is this a reasonable size request for all possible usages of kurifilter? icon = libr_icon_geticon_bysize(handle, icon_size); if(icon == NULL) + { + // Try loading the first icon as fallback + icon = libr_icon_geticon_byid(handle, 0); + } + if(icon == NULL) { kdWarning() << "failed to obtain ELF icon: " << libr_errmsg() << endl; libr_close(handle);