{ "id": "140950", "key": "TIMOB-18137", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "16704", "description": "Release 3.5.0", "name": "Release 3.5.0", "archived": false, "released": true, "releaseDate": "2015-01-13" }, { "id": "16593", "description": "Release 4.0.0", "name": "Release 4.0.0", "archived": false, "released": true, "releaseDate": "2015-05-21" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-12-07T23:34:42.000+0000", "created": "2014-12-04T08:32:59.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "qe-3.5.0", "qe-assigned", "regression" ], "versions": [ { "id": "16704", "description": "Release 3.5.0", "name": "Release 3.5.0", "archived": false, "released": true, "releaseDate": "2015-01-13" } ], "issuelinks": [ { "id": "43700", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "140942", "key": "TIMOB-18135", "fields": { "summary": "iOS: App is crashing for null check in JavaScript variables", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2014-12-09T22:21:10.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "When a variable is compared against null or undefined in the same 'if' clause as shown below the app crashes:\r\n\r\n{code}\r\nif (result == null || result == undefined )\r\n{....}\r\n{code}\r\n\r\nhowever, if they are done separately, i.e, \r\n{code}\r\nif (result == null) \r\nif (result == undefined)\r\n{code}\r\n\r\nthere 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:\r\n\r\n{code}\r\nif (result== undefined || result == null){...}\r\n{code}\r\n\r\nThis is a regression as it works fine with 3.4.1\r\n\r\nSteps to reproduce:\r\n1. run the attached app.js\r\n2. click on the TEXTFIELD button \r\n\r\nActual results:\r\n2. log displays :\r\n {code}\r\n [INFO] : \r\n [INFO] : \r\n [INFO] : ****************\r\n [INFO] : TEXTFIELD\r\n [INFO] : result undefined\r\n {code}\r\n \r\nand the app also crashes \r\n\r\nExpected Results:\r\n2. log should display :\r\n {code}\r\n [INFO] : \r\n [INFO] : \r\n [INFO] : ****************\r\n [INFO] : TEXTFIELD\r\n [INFO] : result undefined\r\n [INFO] : NO selection info available from property\r\n [INFO] : ****************\r\n {code}\r\n\r\n and the app should not crash \r\n", "attachment": [ { "id": "53010", "filename": "app.js", "author": { "name": "vchidambaram", "key": "vchidambaram", "displayName": "Visalakshi Chidambaram", "active": true, "timeZone": "Asia/Shanghai" }, "created": "2014-12-04T08:32:59.000+0000", "size": 1424, "mimeType": "application/x-javascript" } ], "flagged": false, "summary": "iOS: app crashes when comparing variables against null or undefined in the same 'if' statement", "creator": { "name": "vchidambaram", "key": "vchidambaram", "displayName": "Visalakshi Chidambaram", "active": true, "timeZone": "Asia/Shanghai" }, "subtasks": [], "reporter": { "name": "vchidambaram", "key": "vchidambaram", "displayName": "Visalakshi Chidambaram", "active": true, "timeZone": "Asia/Shanghai" }, "environment": "Test Environment: \r\nAppc-Studio: 3.4.1.201410281743 \r\nTitanium SDK: 3.5.0.v20141203160911\r\nTitanium CLI: 3.4.1 \r\nAlloy : 1.5.1 GA \r\nOS: Mac OSX 10.10 \r\nXcode: 6.1 \r\nDevice: iphone 5s (iOS8.1)", "closedSprints": [ { "id": 126, "state": "closed", "name": "2018 Sprint 05 SDK", "startDate": "2018-02-25T19:38:08.926Z", "endDate": "2018-03-11T18:38:00.000Z", "completeDate": "2018-03-11T22:06:01.520Z", "originBoardId": 100 } ], "comment": { "comments": [ { "id": "334802", "author": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "body": "Pretty sure this is an expected Javascript behavior. null is a special value in most languages, and when you try to type-covert and check an object to null, unexpected (to you) things may happen.\r\n\r\nSee http://stackoverflow.com/questions/16672743/javascript-null-check", "updateAuthor": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "created": "2014-12-04T09:25:11.000+0000", "updated": "2014-12-04T09:25:11.000+0000" }, { "id": "334840", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "It may be expected, but it appears to be a behavior change from 3.4.1.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-12-04T16:01:21.000+0000", "updated": "2014-12-04T16:01:21.000+0000" }, { "id": "335038", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Does condition have sense or not have nothing to do with app crash (which should really not happen!)", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2014-12-05T14:30:33.000+0000", "updated": "2014-12-05T14:30:33.000+0000" }, { "id": "335712", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified working as expected using:\r\n\r\nTitanium SDK 3.5.0.v20141208092926\r\nStudio 3.4.1.201410281743 \r\nXcode 6.1.1\r\n\r\nOn: \r\niPad mini, iOS 8.1\r\niPhone 6, iOS 8.2b \r\niPhone 4S Sim, iOS 8.1", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-12-09T22:21:02.000+0000", "updated": "2014-12-09T22:21:02.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }