fix NPE (possible race condition)

This commit is contained in:
Eric House 2013-10-23 08:01:11 -07:00
parent ea4a2ea609
commit ddb64d3dc9

View file

@ -201,14 +201,14 @@ public class ExpiringDelegate {
m_pct = (int)((100 * passed) / INTERVAL_SECS); m_pct = (int)((100 * passed) / INTERVAL_SECS);
if ( m_pct > 100 ) { if ( m_pct > 100 ) {
m_pct = 100; m_pct = 100;
} else { } else if ( null != m_handler ) {
long onePct = INTERVAL_SECS / 100; long onePct = INTERVAL_SECS / 100;
long lastStart = m_startSecs + (onePct * m_pct); long lastStart = m_startSecs + (onePct * m_pct);
Assert.assertTrue( lastStart <= now ); Assert.assertTrue( lastStart <= now );
long nextStartIn = lastStart + onePct - now; long nextStartIn = lastStart + onePct - now;
// DbgUtils.logf( "pct change %d seconds from now", nextStartIn ); // DbgUtils.logf( "pct change %d seconds from now", nextStartIn );
m_handler.postDelayed( mkRunnable(), 1000 * nextStartIn ); m_handler.postDelayed( mkRunnable(), 1000 * nextStartIn ); // NPE
} }
} }
} }