From ddb64d3dc9c88f8a87bd4233208522adb09de18b Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 23 Oct 2013 08:01:11 -0700 Subject: [PATCH] fix NPE (possible race condition) --- .../XWords4/src/org/eehouse/android/xw4/ExpiringDelegate.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringDelegate.java index 18ea62fea..28b89470f 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringDelegate.java @@ -201,14 +201,14 @@ public class ExpiringDelegate { m_pct = (int)((100 * passed) / INTERVAL_SECS); if ( m_pct > 100 ) { m_pct = 100; - } else { + } else if ( null != m_handler ) { long onePct = INTERVAL_SECS / 100; long lastStart = m_startSecs + (onePct * m_pct); Assert.assertTrue( lastStart <= now ); long nextStartIn = lastStart + onePct - now; // DbgUtils.logf( "pct change %d seconds from now", nextStartIn ); - m_handler.postDelayed( mkRunnable(), 1000 * nextStartIn ); + m_handler.postDelayed( mkRunnable(), 1000 * nextStartIn ); // NPE } } }