Skip to content

Commit

Permalink
Restrict 1000d96 to overlays only
Browse files Browse the repository at this point in the history
Allowing empty paths for buttons too breaks auto-assignment of non-specified button images in themes.
  • Loading branch information
Vultraz committed May 5, 2017
1 parent 3ad8dda commit 8128093
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/widgets/button.cpp
Expand Up @@ -394,7 +394,7 @@ bool button::hit(int x, int y) const
return sdl::point_in_rect(x,y,location());
}

static bool is_valid_image(const std::string& str) { return str[0] != IMAGE_PREFIX; }
static bool is_valid_image(const std::string& str) { return !str.empty() && str[0] != IMAGE_PREFIX; }

void button::set_image(const std::string& image_file)
{
Expand All @@ -409,7 +409,8 @@ void button::set_image(const std::string& image_file)

void button::set_overlay(const std::string& image_file)
{
if(!is_valid_image(image_file)) {
// We allow empty paths for overlays
if(image_file[0] == IMAGE_PREFIX) {
return;
}

Expand Down

0 comments on commit 8128093

Please sign in to comment.