Resolves issues with NPE handling and loading external icons.

This commit is contained in:
Denny
2018-01-01 07:24:37 -05:00
parent c7f00ea124
commit e9aeb09011
3 changed files with 46 additions and 19 deletions

View File

@@ -81,16 +81,23 @@ public class Icon implements Comparable<Icon>
{
try
{
URL imageURL = Icon.class.getResource(mPath);
if(imageURL == null && !mPath.startsWith("/"))
if(mPath.startsWith("/"))
{
imageURL = (Icon.class.getResource("/" + mPath));
mImageIcon = new ImageIcon(mPath);
}
if(imageURL != null)
else
{
mImageIcon = new ImageIcon(imageURL);
URL imageURL = Icon.class.getResource(mPath);
if(imageURL == null && !mPath.startsWith("/"))
{
imageURL = (Icon.class.getResource("/" + mPath));
}
if(imageURL != null)
{
mImageIcon = new ImageIcon(imageURL);
}
}
}
catch(Exception e)