Skip to content

Commit 4ebf1f4

Browse files
committed
catch and show exceptions thrown at printing
1 parent 71da396 commit 4ebf1f4

File tree

1 file changed

+5
-1
lines changed
  • app/src/main/kotlin/com/simplemobiletools/notes/pro/activities

1 file changed

+5
-1
lines changed

app/src/main/kotlin/com/simplemobiletools/notes/pro/activities/MainActivity.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,11 @@ class MainActivity : SimpleActivity() {
11691169
val printAdapter = webView.createPrintDocumentAdapter(jobName)
11701170

11711171
(getSystemService(Context.PRINT_SERVICE) as? PrintManager)?.apply {
1172-
print(jobName, printAdapter, PrintAttributes.Builder().build())
1172+
try {
1173+
print(jobName, printAdapter, PrintAttributes.Builder().build())
1174+
} catch (e: IllegalStateException) {
1175+
showErrorToast(e)
1176+
}
11731177
}
11741178
}
11751179

0 commit comments

Comments
 (0)