aboutsummaryrefslogtreecommitdiffstats
path: root/draw9patch/src
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2011-02-04 09:07:27 -0800
committerTor Norbye <tnorbye@google.com>2011-02-04 09:48:47 -0800
commitcfd04ede0d3230a91e0096c5b7c80d3bc76a1f6b (patch)
treeaf17979023d8841713e6c30856ecf9c595bbe5c3 /draw9patch/src
parente1e78fe1f5767925a6d411270064e434758250ec (diff)
downloadsdk-cfd04ede0d3230a91e0096c5b7c80d3bc76a1f6b.zip
sdk-cfd04ede0d3230a91e0096c5b7c80d3bc76a1f6b.tar.gz
sdk-cfd04ede0d3230a91e0096c5b7c80d3bc76a1f6b.tar.bz2
Prevent java.lang.ArithmeticException in draw9patch
Initialize the zoom field to 1 instead of the default 0 since I ran into a scenario where a division by an uninitialized zoom caused a divide by zero exception. Exception in thread "AWT-EventQueue-0" java.lang.ArithmeticException: / by zero at com.android.draw9patch.ui.ImageEditorPanel$ImageViewer.checkLockedR egion(ImageEditorPanel.java:894) at com.android.draw9patch.ui.ImageEditorPanel$ImageViewer.access$1800( ImageEditorPanel.java:646) at com.android.draw9patch.ui.ImageEditorPanel$ImageViewer$3.mouseMoved (ImageEditorPanel.java:745) at java.awt.Component.processMouseMotionEvent(Component.java:6397) Change-Id: I7d2252f07458864d591be91636477ace4b520855
Diffstat (limited to 'draw9patch/src')
-rw-r--r--draw9patch/src/com/android/draw9patch/ui/ImageEditorPanel.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/draw9patch/src/com/android/draw9patch/ui/ImageEditorPanel.java b/draw9patch/src/com/android/draw9patch/ui/ImageEditorPanel.java
index 1afc2ce..e0aa026 100644
--- a/draw9patch/src/com/android/draw9patch/ui/ImageEditorPanel.java
+++ b/draw9patch/src/com/android/draw9patch/ui/ImageEditorPanel.java
@@ -655,7 +655,7 @@ class ImageEditorPanel extends JPanel {
private static final double STRIPES_SPACING = 6.0;
private static final int STRIPES_ANGLE = 45;
- private int zoom;
+ private int zoom = DEFAULT_ZOOM;
private boolean showPatches;
private boolean showLock = true;