Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d95244fa authored by Dan Egnor's avatar Dan Egnor
Browse files

Fix NPE in FileObserver when multiple events pile in for a defunct

observer.  Also, fix up some bogus whitespace (hard tabs, etc).
parent 53bd2522
Loading
Loading
Loading
Loading
+66 −64
Original line number Diff line number Diff line
@@ -88,15 +88,17 @@ public abstract class FileObserver {

        public void onEvent(int wfd, int mask, String path) {
            // look up our observer, fixing up the map if necessary...
        FileObserver observer;
            FileObserver observer = null;

            synchronized (m_observers) {
                WeakReference weak = m_observers.get(wfd);
                if (weak != null) {  // can happen with lots of events from a dead wfd
                    observer = (FileObserver) weak.get();
                    if (observer == null) {
                        m_observers.remove(wfd);
                    }
                }
            }

            // ...then call out to the observer without the sync lock held
            if (observer != null) {