All pastes #1828654 Raw Edit

Unnamed

public diff v1 · immutable
#1828654 ·published 2010-03-08 16:20 UTC
rendered paste body
From 8c453bc491b03fd4580c6bf1150d9af0e1d68f59 Mon Sep 17 00:00:00 2001From: Andrei Karas <akaras@inbox.ru>Date: Mon, 8 Mar 2010 18:17:09 +0200Subject: [PATCH] Fix crush with incorrect wallpaper names.--- src/resources/wallpaper.cpp |   24 ++++++++++++++---------- 1 files changed, 14 insertions(+), 10 deletions(-)diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cppindex 1f42350..6e63776 100644--- a/src/resources/wallpaper.cpp+++ b/src/resources/wallpaper.cpp@@ -76,17 +76,21 @@ void Wallpaper::loadWallpapers()         int separator = filename.rfind("_");         filename = filename.substr(0, separator); -        // Then, append the width and height search mask.-        filename.append("_%dx%d.png");--        if (sscanf(*i, filename.c_str(), &width, &height) == 2)+        separator = filename.find("%");+        if (separator == std::string::npos)         {-            WallpaperData wp;-            wp.filename = WALLPAPER_FOLDER;-            wp.filename.append(*i);-            wp.width = width;-            wp.height = height;-            wallpaperData.push_back(wp);+            // Then, append the width and height search mask.+            filename.append("_%dx%d.png");++            if (sscanf(*i, filename.c_str(), &width, &height) == 2)+            {+                WallpaperData wp;+                wp.filename = WALLPAPER_FOLDER;+                wp.filename.append(*i);+                wp.width = width;+                wp.height = height;+                wallpaperData.push_back(wp);+            }         }     } -- 1.7.0