From 78427051efe74701ca98e26a82703ba31d775764 Mon Sep 17 00:00:00 2001 From: Maria Sokolova Date: Mon, 17 Feb 2025 14:47:45 +0100 Subject: [PATCH] [coroutines-debuuger] Fix CoroutinesDebugHelper#dumpCoroutinesInfoAsJsonAndReferences return null in case of an error GitOrigin-RevId: d0a7ff5f6ea4932ca570044ec348aabd1bdb95d4 --- .../debugger/coroutines/CoroutinesDebugHelper.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/java/java-runtime/src/com/intellij/rt/debugger/coroutines/CoroutinesDebugHelper.java b/java/java-runtime/src/com/intellij/rt/debugger/coroutines/CoroutinesDebugHelper.java index 3cd6684fec58..c560bd291c60 100644 --- a/java/java-runtime/src/com/intellij/rt/debugger/coroutines/CoroutinesDebugHelper.java +++ b/java/java-runtime/src/com/intellij/rt/debugger/coroutines/CoroutinesDebugHelper.java @@ -146,10 +146,14 @@ public final class CoroutinesDebugHelper { public static Object[] dumpCoroutinesInfoAsJsonAndReferences() throws ReflectiveOperationException { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - Class debugProbesImplClass = classLoader.loadClass("kotlinx.coroutines.debug.internal.DebugProbesImpl"); - Object debugProbesImplInstance = debugProbesImplClass.getField("INSTANCE").get(null); - Object[] infos = (Object[])invoke(debugProbesImplInstance, "dumpCoroutinesInfoAsJsonAndReferences"); - return infos; + try { + Class debugProbesImplClass = classLoader.loadClass("kotlinx.coroutines.debug.internal.DebugProbesImpl"); + Object debugProbesImplInstance = debugProbesImplClass.getField("INSTANCE").get(null); + Object[] infos = (Object[])invoke(debugProbesImplInstance, "dumpCoroutinesInfoAsJsonAndReferences"); + return infos; + } catch (Throwable e) { + return null; + } } /**