From 34dc1208f3eae7659e7930995de0c2db392fedcb Mon Sep 17 00:00:00 2001 From: Fedor Isakov Date: Fri, 24 Jun 2016 14:21:36 +0200 Subject: [PATCH] Avoid runnig potentially unsafe code in finally{}, which can mask the original exception. --- .../mps/logic/reactor/core/MemEvaluationSession.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/reactor/Core/src/jetbrains/mps/logic/reactor/core/MemEvaluationSession.kt b/reactor/Core/src/jetbrains/mps/logic/reactor/core/MemEvaluationSession.kt index f68ca15e..2c28bf28 100644 --- a/reactor/Core/src/jetbrains/mps/logic/reactor/core/MemEvaluationSession.kt +++ b/reactor/Core/src/jetbrains/mps/logic/reactor/core/MemEvaluationSession.kt @@ -58,16 +58,17 @@ class MemEvaluationSession : EvaluationSession, SessionObjects { ourBackend.ourSession.set(session) val durations = myParameters.get("profiling.data") as MutableMap? - val profiler = durations?.let{ Profiler() } + val profiler = durations?.let { Profiler() } try { session.launch(myParameters["main"] as Constraint, profiler) } finally { ourBackend.ourSession.set(null) - profiler?.run { - formattedData().entries.forEach { e -> durations?.put(e.key, e.value) } - clear() - } + } + + profiler?.run { + formattedData().entries.forEach { e -> durations?.put(e.key, e.value) } + clear() } return session