Skip to content

Commit 89883fc

Browse files
committed
[Offscreen] Improve solving robustness.
1 parent 1b66bda commit 89883fc

File tree

1 file changed

+7
-1
lines changed
  • samples/offscreen-interactivity/src/main/java/com/myscript/iink/demo/inksample/ui

1 file changed

+7
-1
lines changed

samples/offscreen-interactivity/src/main/java/com/myscript/iink/demo/inksample/ui/InkViewModel.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,14 @@ class InkViewModel(
348348
recognitionRoot.elements?.forEach { element ->
349349
if (element.expressions != null) {
350350

351+
val isSolvable = try {
352+
offscreenEditor?.mathSolverController?.getAvailableActions(element.id)?.contains("numerical-computation") == true
353+
} catch (e: IllegalArgumentException) {
354+
false
355+
}
356+
351357
// If possible, get solver output and strokes.
352-
if (offscreenEditor?.mathSolverController?.getAvailableActions(element.id)?.contains("numerical-computation") == true) {
358+
if (isSolvable) {
353359
val solverJIIX = offscreenEditor?.mathSolverController?.getActionOutput(element.id, "numerical-computation", MimeType.JIIX, engine?.createParameterSet()?.apply {
354360
setBoolean("export.jiix.strokes", true);
355361
})

0 commit comments

Comments
 (0)