From cc18e691daae1326eea655adc27fc0e0453bddcf Mon Sep 17 00:00:00 2001 From: Edi Toropov <81047355+123edi10@users.noreply.github.com> Date: Tue, 26 Nov 2024 17:58:09 +0200 Subject: [PATCH] Update index.js Change indentation Update index.js Add try, finally --- index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 246e88e..b54e452 100644 --- a/index.js +++ b/index.js @@ -219,9 +219,14 @@ class Runtime { withRunnableArtThread(vm, env, thread => { const collectClassHandles = makeArtClassVisitor(klass => { const handle = addGlobalReference(vmHandle, thread, klass); - const className = env.getClassName(handle); - callbacks.onMatch(className, handle); - env.deleteGlobalRef(handle); + try { + const className = env.getClassName(handle); + callbacks.onMatch(className, handle); + env.deleteGlobalRef(handle); + } + finally { + env.deleteGlobalRef(handle); + } return true; });