1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Projucer: Check project item still exists when initialising exporter icon settings and reset to default if missing

This commit is contained in:
ed 2021-07-15 09:30:48 +01:00
parent d5373eed02
commit 0b79bcec69

View file

@ -333,12 +333,21 @@ void ProjectExporter::createIconProperties (PropertyListBuilder& props)
choices.add ("<None>");
ids.add (var());
for (int i = 0; i < images.size(); ++i)
for (const auto* imageItem : images)
{
choices.add (images.getUnchecked(i)->getName());
ids.add (images.getUnchecked(i)->getID());
choices.add (imageItem->getName());
ids.add (imageItem->getID());
}
const auto resetToDefaultIfFileMissing = [&ids] (ValueWithDefault& v)
{
if (! v.isUsingDefault() && ! ids.contains (v.get()))
v.resetToDefault();
};
resetToDefaultIfFileMissing (smallIconValue);
resetToDefaultIfFileMissing (bigIconValue);
props.add (new ChoicePropertyComponent (smallIconValue, "Icon (Small)", choices, ids),
"Sets an icon to use for the executable.");