From 575820917008f6265175b110cddcac6cc7bbac6e Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Mon, 18 Aug 2014 23:15:25 +0000 Subject: [PATCH] Fix a crasher when launching an application whose icon is corrupt It is possible for OPK links to refer to a missing icon or to an icon that cannot be read as a PNG file, in which cases there is no fallback to icons/generic.png and the icon is null. Link::paint checks for this, but LinkApp::drawLaunch did not. Obviously it is more desirable to properly fall back, but that would be a very big change to many areas of the code, so this is a quick fix. --- src/linkapp.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/linkapp.cpp b/src/linkapp.cpp index 3d9e978..90f50e2 100644 --- a/src/linkapp.cpp +++ b/src/linkapp.cpp @@ -398,7 +398,9 @@ void LinkApp::drawLaunch(Surface& s) { gmenu2x->sc[getIcon()]->blit(gmenu2x->s,x,104); else gmenu2x->sc["icons/generic.png"]->blit(gmenu2x->s,x,104);*/ - iconSurface->blit(s, x, gmenu2x->halfY - 16); + if (iconSurface) { + iconSurface->blit(s, x, gmenu2x->halfY - 16); + } gmenu2x->font->write(s, text, x + 42, gmenu2x->halfY + 1, Font::HAlignLeft, Font::VAlignMiddle); }