Nethajik / opensudoku-android

Automatically exported from code.google.com/p/opensudoku-android
0 stars 0 forks source link

Crash if rotate after deleting a game #173

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
1. Start
2. Select a level
3. Long-click a game. The context menu pops up
4. Select "Edit note"
5. A dialog pops up. Cancel it.
6. Long-click the same game. The context menu pops up again
7. Select "Delete puzzle"
8. A confirmation dialog pops up. Click "OK"
9. Rotate your phone, switch to another orientation.
10. Crash

What is the expected output? What do you see instead?
It should not crash.

What version of the product are you using? On what operating system?
Crash on Nexus 4, OpenSudoku version 1.1.5, Android 4.2

Stack trace: 
E/AndroidRuntime( 6623): FATAL EXCEPTION: main
E/AndroidRuntime( 6623): java.lang.RuntimeException: Unable to start activity 
ComponentInfo{cz.romario.opensudoku/cz.romario.opensudoku.gui.SudokuListActivity
}: java.lang.NullPointerException
E/AndroidRuntime( 6623): at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
E/AndroidRuntime( 6623): at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
E/AndroidRuntime( 6623): at 
android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3692)
E/AndroidRuntime( 6623): at 
android.app.ActivityThread.access$700(ActivityThread.java:141)
E/AndroidRuntime( 6623): at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1240)
E/AndroidRuntime( 6623): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 6623): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 6623): at 
android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime( 6623): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 6623): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 6623): at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime( 6623): at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime( 6623): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 6623): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 6623): at 
cz.romario.opensudoku.gui.SudokuListActivity.onPrepareDialog(SudokuListActivity.
java:333)
E/AndroidRuntime( 6623): at 
android.app.Activity.onPrepareDialog(Activity.java:3007)
E/AndroidRuntime( 6623): at 
android.app.Activity.restoreManagedDialogs(Activity.java:968)
E/AndroidRuntime( 6623): at 
android.app.Activity.performRestoreInstanceState(Activity.java:911)
E/AndroidRuntime( 6623): at 
android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.j
ava:1131)
E/AndroidRuntime( 6623): at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2158)
E/AndroidRuntime( 6623): ... 12 more
W/ActivityManager( 517): Force finishing activity 
cz.romario.opensudoku/.gui.SudokuListActivity

The reason seems to be that, since the game was deleted, the "game" variable is 
null at line 333 of src/cz/romario/opensudoku/gui/SudokuListActivity.java, so 
it caused a NullPointerException. Please check this condition and fix it.

Original issue reported on code.google.com by Henry.Hu...@gmail.com on 25 Mar 2013 at 10:45