Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-18137

iOS: app crashes when comparing variables against null or undefined in the same 'if' statement


    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Release 3.5.0
    • Fix Version/s: Release 3.5.0, Release 4.0.0
    • Component/s: iOS
    • Environment:

      Test Environment:
      Titanium SDK: 3.5.0.v20141203160911
      Titanium CLI: 3.4.1
      Alloy : 1.5.1 GA
      OS: Mac OSX 10.10
      Xcode: 6.1
      Device: iphone 5s (iOS8.1)

    • Sprint:
      2018 Sprint 05 SDK


      When a variable is compared against null or undefined in the same 'if' clause as shown below the app crashes:

      if (result == null || result == undefined )

      however, if they are done separately, i.e,

      if (result == null) 
      if (result == undefined)

      there is no issue and both the if statements are executed as the actual value of the results in this example will be undefined. Likewise comparing undefined before null also works fine:

      if (result== undefined || result == null){...}

      This is a regression as it works fine with 3.4.1

      Steps to reproduce:
      1. run the attached app.js
      2. click on the TEXTFIELD button

      Actual results:
      2. log displays :

         [INFO] :   
         [INFO] :   
         [INFO] :   ****************
         [INFO] :   TEXTFIELD
         [INFO] :   result undefined

      and the app also crashes

      Expected Results:
      2. log should display :

        [INFO] :   
        [INFO] :   
        [INFO] :   ****************
        [INFO] :   TEXTFIELD
        [INFO] :   result undefined
        [INFO] :   NO selection info available from property
        [INFO] :   ****************

      and the app should not crash


          Issue Links



              • Assignee:
                vduggal Vishal Duggal (Inactive)
                vchidambaram Visalakshi Chidambaram
              • Watchers:
                0 Start watching this issue


                • Created:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    Sync status:
                    Last received:
                    Last sent:

                    Git Integration