[TIMOB-997] hasText crashes if in IF Statement
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2012-05-04T11:23:08.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 2.1.0 |
| Components | iOS |
| Labels | core, module_textfield, qe-testadded, training |
| Reporter | Ryan G |
| Assignee | Neeraj Gupta |
| Created | 2011-04-15T02:41:09.000+0000 |
| Updated | 2013-11-07T05:31:54.000+0000 |
Description
line 116
(name.hasText) will crash. (name.value!='') works fine.
Attachments
| File | Date | Size |
|---|---|---|
| consoleLog.txt | 2011-08-16T16:28:21.000+0000 | 3237 |
| crashLog.txt | 2011-08-16T16:28:21.000+0000 | 46439 |
| setupapp.js | 2011-04-15T02:41:09.000+0000 | 3153 |
This is still an issue in Titanium 1.5.1 and iOS 4.2.1.
Bug Scrub: Valid. Test case required Tested on : Mac OSX Lion TiMob 1.8.0 TiStud: 1.0.4.201108101535 Device: iPhone Simulator
Please attach console log and crash log, then reassign to me.
Console Log and Crash Log attached.
Fixed in master 2.1.0.848d711
Closing as Fixed. Verified via modified TIDOC-461 > hasText.js attachment (modified code below). SDK: 2.1.0.v20120613210250 Studio: 2.1.0.201206131907 OS: Snow Leopard Devices Tested: iPhone Simulator 5.0, iPhone4 5.0.1, iPad2 4.3.5 Steps to Test: 1. Run code below.
2. Select the text field and type a few characters. Expected Result: No crash. 'No Bug!' logs to console for every character typed.var win = Ti.UI.createWindow({ backgroundColor: '#eee', title: 'hasText bug' }); var containerView = Ti.UI.createView({ height:30, width : 100 }); var textField = Ti.UI.createTextField({ height:30, color: '#000', font: {fontFamily:'Helvetica Neue', fontSize:12, fontWeight:'bold'}, clearButtonMode: Ti.UI.INPUT_BUTTONMODE_ALWAYS, appearance:Ti.UI.KEYBOARD_APPEARANCE_ALERT, returnKeyType:Ti.UI.RETURNKEY_DONE, //DONE // NEXT // SEND suppressReturn:true, borderStyle:Ti.UI.INPUT_BORDERSTYLE_ROUNDED, width : 70 }); textField.addEventListener('change', function(e) { try { if(textField.hasText()) { Ti.API.log("No bug!"); } } catch(e) { Ti.API.warn(e.message); } }); // hide the keyboard when a user click out-side the field win.addEventListener('click', function() { textField.blur(); }) containerView.add(textField); win.add(containerView); win.open();Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/4863