Just invested hours in finding a failure within my code. There are rare situations when this routine gives out an "unexpected zero". I will put a picture below. In my program two "NMEA"-routines are running, the old fashioned one and the new one above, so the program can give NMEA-altitude-measurements on older android versions and newer ones.
A little bit hard to explain what my code does...
Short, a flag will be set if the new NMEA-code gives out a valid value. If valid, an altitude below zero is not needed, it will set to zero by code. After that I have to split the altitude-value into seperate digits for assigning it to a special graphical view (digit will be displayed within a bitmap, desing needs it). So I have to know the length of the altitude-string for calculating digit position and picture to be loaded (centering reasons and again graphical needs). The following string operation must fail based on the length of the string of the altitude (there the error comes up, the debugger is pointing to that line) "-0" is different to "0", a length mismatch and my code tryed to put a digit-bitmap to the minus sign and failed.
Look at the picture now. In the right pane you can see the error. The routine gives out a "-0" under some cirmumstances. I waited hours to catch this error. So normally a zero is zero and not minus zero. Knowing about that problem is enough, so there is simple workaround when working with integers in that special case.
If Altitude < 0 Then Altitude = 0
changes to
If Altitude < 1 Then Altitude = 0
This will hopefully fix this issue.
Not a big thing, but it may a little help when working with the routine above. Hopefully nobody of you has to spent hours for hunting of this. That's the reason for this post.
Cheers BV