mariomac / microemu

Automatically exported from code.google.com/p/microemu
0 stars 0 forks source link

java.lang.NullPointerException at android.graphics.Matrix.preConcat(Matrix.java:233) #100

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. With Android 2.3.4
2. at 
org.microemu.android.device.ui.AndroidCanvasUI$CanvasView.onDraw(AndroidCanvasUI
.java:225)
3. at 
org.microemu.android.device.AndroidDisplayGraphics.reset(AndroidDisplayGraphics.
java:96)
4. at android.view.Surface$CompatibleCanvas.setMatrix(Surface.java:259)
5. java.lang.NullPointerException at 
android.graphics.Matrix.preConcat(Matrix.java:233)

What is the expected output? 

No error in here.

What do you see instead?

The full application crashes!!

What version of the product are you using? 

Android 2.3.4

On what operating system?

Android 2.3.4

Please provide any additional information below.

Look like this is a bug in Android itself. They say:

http://developer.android.com/reference/android/graphics/Canvas.html#setMatrix%28
android.graphics.Matrix%29

"If the matrix parameter is null, then the current matrix is reset to identity."

In 
"microemu-android\src\org\microemu\android\device\AndroidDisplayGraphics.java" 
at 96, the line shows as:

this.canvas.setMatrix(null);

so that, this patch fixes their problem:

try { this.canvas.setMatrix(null); } catch(Throwable e) { }

I have attached the fixed file.

Best regards,

Jose

Original issue reported on code.google.com by j...@toro-asia.com on 23 Sep 2011 at 4:24

Attachments:

GoogleCodeExporter commented 8 years ago
I forgot mention the fix is for the MicroEmulator 3.0.0

Original comment by j...@toro-asia.com on 23 Sep 2011 at 4:30

GoogleCodeExporter commented 8 years ago
Fixed in trunk. Modified the fix a bit not to throw exception.

Original comment by bar...@gmail.com on 18 Oct 2011 at 6:37