I do a lot of embedded programming and use 1 for true and 0 for false. Out of habit, I used 1 for true in a B4A program. The program compiled and installed but then crashed when it was run. It took a while to figure it out since the SomethingSomething was a rare occurrence and I glossed over the HD=1 from familiarity.
Bug fix request: Flag as an error in the IDE or allow it in parseBoolean.
The resulting error log (trimmed)
Bug fix request: Flag as an error in the IDE or allow it in parseBoolean.
B4X:
Dim HD as Boolean
' This compiles
If SomethingSomething then HD=1
The resulting error log (trimmed)
B4X:
java.lang.RuntimeException: Cannot parse: 1 as boolean
at anywheresoftware.b4a.BA.parseBoolean(BA.java:640)
at anywheresoftware.b4a.BA.ObjectToBoolean(BA.java:710)
Last edited: