Skip to content

Commit

Permalink
Fix scheduled-swap crash
Browse files Browse the repository at this point in the history
It turns out that, with the right timing, onItemSelected() can be
called while the activity is paused.
  • Loading branch information
fadden committed May 22, 2014
1 parent 8a2b595 commit f3c8c3d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/com/android/grafika/ScheduledSwapActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,10 @@ public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
throw new RuntimeException("Unknown spinner");
}

if (updated) {
if (mRenderThread == null) {
// huh
Log.d(TAG, "In onItemSelected while the activity is paused");
} else if (updated) {
RenderHandler rh = mRenderThread.getHandler();
if (rh != null) {
rh.sendSetParameters(mUpdatePatternIndex, mFramesAheadIndex);
Expand Down

0 comments on commit f3c8c3d

Please sign in to comment.