diff --git a/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ShowByteCodeAction.java b/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ShowByteCodeAction.java index e3c5cdd7b6da..3a0a6d8fca59 100644 --- a/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ShowByteCodeAction.java +++ b/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ShowByteCodeAction.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.byteCodeViewer; import com.intellij.codeInsight.lookup.LookupManager; @@ -83,7 +83,10 @@ final class ShowByteCodeAction extends AnAction implements UpdateInBackground { isMarkedForCompilation(project, virtualFile)) { myErrorTitle = JavaByteCodeViewerBundle.message("class.file.may.be.out.of.date"); } - myByteCode = ReadAction.compute(() -> ByteCodeViewerManager.getByteCode(psiElement)); + myByteCode = ReadAction.compute(() -> { + PsiElement targetElement = element.getElement(); + return targetElement != null ? ByteCodeViewerManager.getByteCode(targetElement) : null; + }); } @Override