[TIMOB-6502] MobileWeb: Ti.App.Properties - setting a property to null causes execution failure
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-12-13T16:01:20.000+0000 |
Affected Version/s | Release 1.8.0.1 |
Fix Version/s | Sprint 2011-50, Release 1.8.0.1, Release 2.0.0 |
Components | MobileWeb |
Labels | n/a |
Reporter | Anthony Decena |
Assignee | Anthony Decena |
Created | 2011-12-07T11:56:30.000+0000 |
Updated | 2017-03-03T22:52:33.000+0000 |
Description
If you try and set a property to null rather than using the removeProperty() method, the script execution stops.
Titanium.App.Properties.setString('String',null);
Titanium.API.info("String has been set to null " + Titanium.App.Properties.getString('String'));
The second line above will not execute.
Attachments
File | Date | Size |
---|---|---|
app.js | 2011-12-10T13:29:32.000+0000 | 1373 |
Yeah, this is pretty easy to fix. Just need to do something like:
If val is null or undefined, it'll get set to "". If it's a number, boolean, object, or array, it'll properly be converted to a string. Plus it saves a bunch of precious bytes!
OK, I stand corrected. We MUST support null values to get/setString().
The second Properties.getString line should execute correctly with the changes from this pull request: https://github.com/appcelerator/titanium_mobile/pull/909
Closing ticket.