This only seems to happen when using the default debugger, and only when breakpoints are set in Activity_Create. Interestingly if I set a breakpoint only on line 38 of the program it crashes with a java.lang.RuntimeException: anywheresoftware.b4a.B4AUncaughtException when I rotate the device.
All is fine in both release modes and when using the legacy debugger.
It is a bug in the debugger. As @agraham wrote it will only happen when there is a breakpoint in the sub or that it was modified without making a full compilation (clean project).