mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Fixed a problem with loading the icon from a share, also preventing a NullPointerReference in the MainForm
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2418 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
b9a1bd76b5
commit
5ce65ab191
3 changed files with 48 additions and 8 deletions
|
@ -276,6 +276,7 @@ namespace GreenshotPlugin.Core {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get the icon belonging to the process
|
||||
/// </summary>
|
||||
|
@ -289,11 +290,9 @@ namespace GreenshotPlugin.Core {
|
|||
string filename = ProcessPath;
|
||||
if (!iconCache.ContainsKey(filename)) {
|
||||
Image icon = null;
|
||||
if (File.Exists(filename)) {
|
||||
using (Icon appIcon = Icon.ExtractAssociatedIcon(filename)) {
|
||||
if (appIcon != null) {
|
||||
icon = appIcon.ToBitmap();
|
||||
}
|
||||
using (Icon appIcon = Shell32.ExtractAssociatedIcon(filename)) {
|
||||
if (appIcon != null) {
|
||||
icon = appIcon.ToBitmap();
|
||||
}
|
||||
}
|
||||
iconCache.Add(filename, icon);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue