Bug? java.lang.NullPointerException on Null value

PatrikCavina

Active Member
Licensed User
Longtime User
This code causes an error:
B4X:
    If Null = "aa" Then
        Log("Ok")
    Else
        Log("No")
    End If
But if i write the code in this way errors don't happen::
B4X:
    If "aa" = Null Then
        Log("Ok")
    Else
        Log("No")
    End If

I don't think is a normal behavior
 

sorex

Expert
Licensed User
Longtime User
I guess the logic is that NULL is non existing.

You can't compare something that doesn't exist with a string.

But you can compare a string with being nothing.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…