Stability fix for #1497

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2562 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2013-04-12 13:27:17 +00:00
parent aefa2eace3
commit 0a900bc5d2

View file

@ -15,19 +15,21 @@ namespace ExternalCommand {
if (commandName != null) {
if (!iconCache.ContainsKey(commandName)) {
Image icon = null;
if (File.Exists(config.commandlines[commandName])) {
if (config.commandlines.ContainsKey(commandName) && File.Exists(config.commandlines[commandName])) {
try {
icon = PluginUtils.GetExeIcon(config.commandlines[commandName], 0);
} catch (Exception ex) {
LOG.Warn("Problem loading icon for " + config.commandlines[commandName], ex);
}
}
// Also add null to the cache if nothing is found
iconCache.Add(commandName, icon);
}
return iconCache[commandName];
} else {
return null;
if (iconCache.ContainsKey(commandName)) {
return iconCache[commandName];
}
}
return null;
}
}
}