Skip to content
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

Merged

Conversation

bijupmb
Copy link
Contributor

@bijupmb bijupmb commented Jul 18, 2013

@@ -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;
Copy link
Contributor

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.

Copy link
Contributor Author

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);
Copy link
Contributor

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

@hieupham007
Copy link
Contributor

Code reviewed and functionally tested. Request accepted

hieupham007 added a commit that referenced this pull request Jul 26, 2013
…CauseException

TIMOB-14566 add null value checking
@hieupham007 hieupham007 merged commit f8add0b into tidev:master Jul 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants