Fixes some NPE exceptions when clearing avatar images in UI.

cusax-fix 4750
Damian Minkov 13 years ago
parent 60ee5458cb
commit c9582ea133

@ -160,6 +160,8 @@ public byte[] getClippedImage()
{
BufferedImage fullImage = getResizedImage(true);
if(fullImage == null)
return null;
Rectangle clipping = this.imageClipper.getCroppedArea();
@ -178,6 +180,9 @@ public byte[] getClippedImage()
*/
private BufferedImage getResizedImage(boolean hq)
{
if(this.image == null)
return null;
BufferedImage i = null;
int size = this.imageSizeSlider.getValue();

@ -117,7 +117,9 @@ public void setImageIcon(Image image)
*/
public Image getImage()
{
return icon.getImage();
if(icon != null)
return icon.getImage();
return null;
}
/**

@ -99,6 +99,20 @@ public void setImageIcon(ImageIcon imageIcon)
this.currentImage = imageIcon.getImage();
}
/**
* Sets the image to display in the frame.
*
* @param image the image to display in the frame
*/
public void setImageIcon(byte[] image)
{
// Intercept the action to validate the user icon and not the default
super.setImageIcon(image);
this.isDefaultImage = false;
this.currentImage = super.getImage();
}
/**
* Returns the current image with no rounded corners. Only return the user
* image and not the default image.

Loading…
Cancel
Save