mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 765156 - Fix NPE from getHandler() returning null for a detached view. r=mfinkle
This commit is contained in:
parent
07153819b1
commit
a6904d07f1
@ -5,6 +5,7 @@
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -141,18 +142,20 @@ public class PropertyAnimator extends TimerTask {
|
||||
}
|
||||
|
||||
private void invalidate(final ElementHolder element, final int delta) {
|
||||
View v = (element == null ? null : element.view);
|
||||
if (v == null)
|
||||
final View view = element.view;
|
||||
|
||||
Handler handler = view.getHandler();
|
||||
if (handler == null)
|
||||
return;
|
||||
|
||||
// Post the layout changes on the view's UI thread.
|
||||
v.getHandler().post(new Runnable() {
|
||||
handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Check if the element and view still exist
|
||||
View view = (element == null ? null : element.view);
|
||||
if (view == null)
|
||||
return;
|
||||
// check to see if the view was detached between the check above and this code
|
||||
// getting run on the UI thread.
|
||||
if (view.getHandler() == null)
|
||||
return;
|
||||
|
||||
if (element.property == Property.SLIDE_TOP) {
|
||||
view.scrollTo(view.getScrollX(), delta);
|
||||
|
Loading…
Reference in New Issue
Block a user