1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Bug? Null comparison results in error

Discussion in 'Bugs & wishlist' started by wonder, May 8, 2019.

  1. wonder

    wonder Expert Licensed User

    Comparing an object with Null (or null object) works, but comparing Null with an object doesn't work.

    upload_2019-5-8_22-22-59.png

    Is this normal?

    Here's Python for comparison (no errors):
    upload_2019-5-8_22-25-14.png

    It happens in both B4A and B4J.

    Another example:
    Code:
    Dim A As Object  
    Dim B As Map
    B.Initialize
    Log(A == B.GetDefault("KEY"Null)) 'Works
    Log(B.GetDefault("KEY"Null) == A) 'Crashes
     
    Last edited: May 8, 2019
  2. Erel

    Erel Administrator Staff Member Licensed User

    This is expected as the = operator is not implemented as an identity comparison (with one exception, when the right side is the Null keyword).
     
    wonder likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice