Fix NPE when not adding an avatar.
This prevents a non-existing avatar from being processed.
@@ -165,12 +165,22 @@ public class StatusBar extends JPanel implements VCardListener {
}
public void setAvatar(Icon icon) {
+ if ( icon == null )
+ {
+ imageLabel.setIcon( null );
+ }
+ else
+ {
Image image = ImageCombiner.iconToImage( icon );
- if (icon.getIconHeight() > 64 || icon.getIconWidth() > 64) {
+ if ( icon.getIconHeight() > 64 || icon.getIconWidth() > 64 )
+ {
imageLabel.setIcon( new ImageIcon( image.getScaledInstance( -1, 64, Image.SCALE_SMOOTH ) ) );
- } else {
+ }
+ else
+ {
imageLabel.setIcon( icon );
}
+ }
imageLabel.setBorder(null);
revalidate();
allowProfileEditing();
