Bug 1240506 - Check for null listener in GeckoEditable; r=esawin

It's possible for the listener to be null before nsWindow attaches to a
GeckoView or after it detaches from a GeckoView.
This commit is contained in:
Jim Chen 2016-01-19 13:14:48 -05:00
Родитель dcde606dc7
Коммит ac809b12d2
1 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -907,7 +907,9 @@ final class GeckoEditable extends JNIObject
// Action.TYPE_ACKNOWLEDGE_FOCUS, this line also makes us // Action.TYPE_ACKNOWLEDGE_FOCUS, this line also makes us
// wait for Gecko to update us on the newly focused content // wait for Gecko to update us on the newly focused content
mActionQueue.syncWithGecko(); mActionQueue.syncWithGecko();
mListener.notifyIME(type); if (mListener != null) {
mListener.notifyIME(type);
}
// Unset mFocused after we call syncWithGecko because // Unset mFocused after we call syncWithGecko because
// syncWithGecko becomes a no-op when mFocused is false. // syncWithGecko becomes a no-op when mFocused is false.
@ -947,6 +949,9 @@ final class GeckoEditable extends JNIObject
geckoPostToIc(new Runnable() { geckoPostToIc(new Runnable() {
@Override @Override
public void run() { public void run() {
if (mListener == null) {
return;
}
mListener.notifyIMEContext(state, typeHint, modeHint, actionHint); mListener.notifyIMEContext(state, typeHint, modeHint, actionHint);
} }
}); });
@ -979,6 +984,9 @@ final class GeckoEditable extends JNIObject
geckoPostToIc(new Runnable() { geckoPostToIc(new Runnable() {
@Override @Override
public void run() { public void run() {
if (mListener == null) {
return;
}
mListener.onSelectionChange(newStart, newEnd); mListener.onSelectionChange(newStart, newEnd);
} }
}); });
@ -1089,6 +1097,9 @@ final class GeckoEditable extends JNIObject
geckoPostToIc(new Runnable() { geckoPostToIc(new Runnable() {
@Override @Override
public void run() { public void run() {
if (mListener == null) {
return;
}
mListener.onTextChange(text, start, oldEnd, newEnd); mListener.onTextChange(text, start, oldEnd, newEnd);
} }
}); });