Skip to content

Commit f0a73ec

Browse files
author
Kaushik Gopal
committed
fix: long operation fails on orientation changes in concurrency demo kaushikgopal#2
1 parent 52bc3be commit f0a73ec

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/src/main/java/com/morihacky/android/rxjava/ConcurrencyWithSchedulersDemoFragment.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ public void onNext(Boolean aBoolean) {
107107
@Override
108108
public void onDestroy() {
109109
super.onDestroy();
110-
_subscription.unsubscribe();
110+
if (_subscription != null) {
111+
_subscription.unsubscribe();
112+
}
111113
}
112114

113115
private void _log(String logMsg) {
@@ -142,7 +144,7 @@ private void _doSomeLongOperation_thatBlocksCurrentThread() {
142144
try {
143145
Thread.sleep(3000);
144146
} catch (InterruptedException e) {
145-
e.printStackTrace();
147+
Timber.d("Operation was interrupted");
146148
}
147149
}
148150

0 commit comments

Comments
 (0)