Default to 16x16 icons if the requested size is invalid

The options system currently doesn't support constraints beyond those
forced by the type system, making it easy to set the icon size to a
value which would make it impossible to get to the preferences dialog to
fix it.

Originally committed to SVN as r5469.
This commit is contained in:
Thomas Goyne 2011-07-15 04:06:29 +00:00
parent 88f0659307
commit e75ea7d2e8
1 changed files with 4 additions and 10 deletions

View File

@ -40,31 +40,25 @@ iconMap icon16;
iconMap icon24;
wxBitmap* get(std::string const& name, const int size) {
// XXX: This code will go away with dynamic icon generation so I'm not
// concerned about it.
if (size == 16) {
if (size != 24) {
iconMap::iterator index;
if ((index = icon16.find(name)) != icon16.end()) {
return index->second;
}
printf("icon::get NOT FOUND (%s)\n", name.c_str());
} else if (size == 24) {
}
else {
iconMap::iterator index;
if ((index = icon24.find(name)) != icon24.end()) {
return index->second;
}
printf("icon::get NOT FOUND (%s)\n", name.c_str());
} else {
throw IconInvalid("Valid icon sizes are 16 or 24.");
}
wxBitmap *img = new wxBitmap(); // stub to silence compiler warnings.
return img;
return new wxBitmap();
}