mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 22:20:04 +00:00
Gracefully fallback when icon cannot be loaded
This commit is contained in:
parent
dc284974b3
commit
2fd94c6575
2 changed files with 20 additions and 3 deletions
|
|
@ -446,8 +446,17 @@ void MarkerManager::add_icon(const std::string& name, bool startup)
|
|||
const std::shared_ptr<boost::gil::rgba8_image_t> image =
|
||||
ResourceManager::LoadImageResource(name);
|
||||
|
||||
auto icon = types::MarkerIconInfo(name, -1, -1, image);
|
||||
p->markerIcons_.emplace(name, icon);
|
||||
if (image)
|
||||
{
|
||||
auto icon = types::MarkerIconInfo(name, -1, -1, image);
|
||||
p->markerIcons_.emplace(name, icon);
|
||||
}
|
||||
else
|
||||
{
|
||||
// defaultIconName should always be in markerIcons, so at is fine
|
||||
auto icon = p->markerIcons_.at(defaultIconName);
|
||||
p->markerIcons_.emplace(name, icon);
|
||||
}
|
||||
}
|
||||
|
||||
if (!startup)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue