summaryrefslogtreecommitdiff
path: root/java/ImageProcessing/framework/ImageCanvas.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/ImageProcessing/framework/ImageCanvas.java')
-rw-r--r--java/ImageProcessing/framework/ImageCanvas.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/java/ImageProcessing/framework/ImageCanvas.java b/java/ImageProcessing/framework/ImageCanvas.java
index f527accf545..182bd54bf9b 100644
--- a/java/ImageProcessing/framework/ImageCanvas.java
+++ b/java/ImageProcessing/framework/ImageCanvas.java
@@ -143,10 +143,13 @@ class ImageCanvas extends Canvas
// Check if mouse is within the bounds of the image
private boolean inBounds (int x, int y)
{
- return (x >= this.x_) &&
- (y >= this.y_) &&
- (x <= (this.x_ + this.zoom_ * this.image_.getWidth (this))) &&
- (y <= (this.y_ + this.zoom_ * this.image_.getHeight (this)));
+ if (this.image_ == null)
+ return false;
+ else
+ return (x >= this.x_) &&
+ (y >= this.y_) &&
+ (x <= (this.x_ + this.zoom_ * this.image_.getWidth (this))) &&
+ (y <= (this.y_ + this.zoom_ * this.image_.getHeight (this)));
}
private MediaTracker tracker_ = new MediaTracker(this);