New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TIMOB-14566 add null value checking #4459
TIMOB-14566 add null value checking #4459
Conversation
@@ -562,6 +562,7 @@ public void propertyChanged(String key, Object oldValue, Object newValue, KrollP | |||
} else if (key.equals(TiC.PROPERTY_TOUCH_ENABLED)) { | |||
doSetClickable(TiConvert.toBoolean(newValue)); | |||
} else if (key.equals(TiC.PROPERTY_VISIBLE)) { | |||
newValue = (newValue == null) ? false : newValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to add this check in TiUIView.processProperties() as well b/c user can set "visible: null" during creation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modified
@@ -730,7 +731,7 @@ public void processProperties(KrollDict d) | |||
} | |||
|
|||
if (d.containsKey(TiC.PROPERTY_VISIBLE) && !nativeViewNull) { | |||
setVisibility(TiConvert.toBoolean(d, TiC.PROPERTY_VISIBLE, true) ? View.VISIBLE : View.INVISIBLE); | |||
this.setVisibility(TiConvert.toBoolean(d, TiC.PROPERTY_VISIBLE, false) ? View.VISIBLE : View.INVISIBLE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're modifying default value here. This means that if user don't have the visible flag, the view would be invisible. I think it should be something like this:
visible = d.getProperty(TiC.PROPERTY_VISIBLE);
if (visible != null)
setVisibility(TiConvert.toBoolean(visible, true) ? View.VISIBLE : View.INVISIBLE);
else
setVisibility(View.INVISIBLE)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
Code reviewed and functionally tested. Request accepted |
…CauseException TIMOB-14566 add null value checking
checked null value
https://jira.appcelerator.org/browse/TIMOB-14566