Skip to content

Commit

Permalink
[TIMOB-25471] Improve KrollProxy validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Mathews committed Nov 1, 2017
1 parent da0ca41 commit e58670c
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions android/titanium/src/java/org/appcelerator/kroll/KrollProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,10 @@ public void setIndexedProperty(int index, Object value)
*/
public boolean hasProperty(String name)
{
return properties.containsKey(name);
if (properties != null) {
return properties.containsKey(name);
}
return false;
}

/**
Expand All @@ -587,7 +590,10 @@ public boolean hasProperty(String name)
*/
public boolean hasPropertyAndNotNull(String name)
{
return properties.containsKeyAndNotNull(name);
if (properties != null) {
return properties.containsKeyAndNotNull(name);
}
return false;
}

/**
Expand All @@ -599,7 +605,10 @@ public boolean hasPropertyAndNotNull(String name)
*/
public Object getProperty(String name)
{
return properties.get(name);
if (properties != null) {
return properties.get(name);
}
return null;
}

/**
Expand All @@ -608,6 +617,10 @@ public Object getProperty(String name)
*/
public void setProperty(String name, Object value)
{
if (properties == null) {
return;
}

properties.put(name, value);

if (KrollRuntime.getInstance().isRuntimeThread()) {
Expand Down Expand Up @@ -826,7 +839,7 @@ public boolean fireSyncEvent(String event, Object data, long maxTimeout)
@SuppressWarnings({ "rawtypes", "unchecked" })
public boolean doFireEvent(String event, Object data)
{
if (!hierarchyHasListener(event)) {
if (!hierarchyHasListener(event) || eventListeners == null) {
return false;
}

Expand Down

0 comments on commit e58670c

Please sign in to comment.