jdorothy/WordScramble — Issue #19: Board generation sometimes makes a null word
Author: jdorothy
Created: 2011-11-09 00:30:24+00:00
State: open

My game just crashed because one of the words = null. Here's the log:

`11-08 16:25:35.161: D/dalvikvm(22818): GC_EXTERNAL_ALLOC freed 642 objects / 49832 bytes in 123ms
11-08 16:25:39.676: D/dalvikvm(22818): GC_EXTERNAL_ALLOC freed 197 objects / 9008 bytes in 44ms
11-08 16:25:41.325: D/dalvikvm(22818): GC_EXTERNAL_ALLOC freed 201 objects / 8032 bytes in 44ms
11-08 16:25:41.563: I/System.out(22818): In the dictionary constructor
11-08 16:25:41.575: I/global(22818): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
11-08 16:25:41.958: D/dalvikvm(22818): GC_FOR_MALLOC freed 31583 objects / 774360 bytes in 179ms
11-08 16:25:42.102: I/System.out(22818): entered default word
11-08 16:25:42.102: I/System.out(22818): rownum---->0
11-08 16:25:42.102: I/System.out(22818): columnNum-->1
11-08 16:25:42.106: I/System.out(22818): word is --->urd
11-08 16:25:42.106: I/System.out(22818): inserted diagonally down right
11-08 16:25:42.106: I/System.out(22818): end of default word
11-08 16:25:42.106: I/System.out(22818): GENERATESCRAMBLEFROMTOP
11-08 16:25:42.106: I/System.out(22818): rownum---->0
11-08 16:25:42.106: I/System.out(22818): columnNum-->0
11-08 16:25:42.106: I/System.out(22818): char c is inserted
11-08 16:25:42.106: I/System.out(22818): rownum---->0
11-08 16:25:42.106: I/System.out(22818): columnNum-->2
11-08 16:25:42.106: I/System.out(22818): char v is inserted
11-08 16:25:42.106: I/System.out(22818): word is --->null
11-08 16:25:42.106: I/System.out(22818): inserted diagonally down right
11-08 16:25:42.110: D/AndroidRuntime(22818): Shutting down VM
11-08 16:25:42.110: W/dalvikvm(22818): threadid=1: thread exiting with uncaught exception (group=0x4001d7f0)
11-08 16:25:42.118: E/AndroidRuntime(22818): FATAL EXCEPTION: main
11-08 16:25:42.118: E/AndroidRuntime(22818): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.wordscramble/com.wordscramble.view.GameActivity}: java.lang.NullPointerException
11-08 16:25:42.118: E/AndroidRuntime(22818):	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
11-08 16:25:42.118: E/AndroidRuntime(22818):	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-08 16:25:42.118: E/AndroidRuntime(22818):	at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-08 16:25:42.118: E/AndroidRuntime(22818):	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-08 16:25:42.118: E/AndroidRuntime(22818):	at android.os.Handler.dispatchMessage(Handler.java:99)
11-08 16:25:42.118: E/AndroidRuntime(22818):	at android.os.Looper.loop(Looper.java:123)
11-08 16:25:42.118: E/AndroidRuntime(22818):	at android.app.ActivityThread.main(ActivityThread.java:4627)
11-08 16:25:42.118: E/AndroidRuntime(22818):	at java.lang.reflect.Method.invokeNative(Native Method)
11-08 16:25:42.118: E/AndroidRuntime(22818):	at java.lang.reflect.Method.invoke(Method.java:521)
11-08 16:25:42.118: E/AndroidRuntime(22818):	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
11-08 16:25:42.118: E/AndroidRuntime(22818):	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
11-08 16:25:42.118: E/AndroidRuntime(22818):	at dalvik.system.NativeStart.main(Native Method)
11-08 16:25:42.118: E/AndroidRuntime(22818): Caused by: java.lang.NullPointerException
11-08 16:25:42.118: E/AndroidRuntime(22818):	at com.wordscramble.Scramble.insertDiagnollyDown(Scramble.java:66)
11-08 16:25:42.118: E/AndroidRuntime(22818):	at com.wordscramble.ScrambleGenerator.insertWordsInScramble(ScrambleGenerator.java:135)
11-08 16:25:42.118: E/AndroidRuntime(22818):	at com.wordscramble.ScrambleGenerator.generateScrambleFromTop(ScrambleGenerator.java:246)
11-08 16:25:42.118: E/AndroidRuntime(22818):	at com.wordscramble.ScrambleGenerator.generateScramble(ScrambleGenerator.java:284)
11-08 16:25:42.118: E/AndroidRuntime(22818):	at com.wordscramble.ScrambleGenerator.(ScrambleGenerator.java:40)
11-08 16:25:42.118: E/AndroidRuntime(22818):	at com.wordscramble.view.GameActivity.onCreate(GameActivity.java:93)
11-08 16:25:42.118: E/AndroidRuntime(22818):	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
11-08 16:25:42.118: E/AndroidRuntime(22818):	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
11-08 16:25:42.118: E/AndroidRuntime(22818):	... 11 more`