From e976041732d2a5944593a21c48f4ad114f28c0d7 Mon Sep 17 00:00:00 2001
From: "Egor.Ushakov" <egor.ushakov@jetbrains.com>
Date: Wed, 23 Dec 2015 17:14:58 +0300
Subject: [PATCH] avoid exceptions on getContainingFile()

---
 .../ui/AlternativeSourceNotificationProvider.java         | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/AlternativeSourceNotificationProvider.java b/java/debugger/impl/src/com/intellij/debugger/ui/AlternativeSourceNotificationProvider.java
index 229662154370..43d5851da610 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/AlternativeSourceNotificationProvider.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/AlternativeSourceNotificationProvider.java
@@ -170,17 +170,15 @@ public class AlternativeSourceNotificationProvider extends EditorNotifications.P
           final DebuggerContextImpl context = DebuggerManagerEx.getInstanceEx(project).getContext();
           final DebuggerSession session = context.getDebuggerSession();
           final PsiClass item = ((ComboBoxClassElement)switcher.getSelectedItem()).myClass;
-          if (session != null) {
+          final VirtualFile vFile = item.getContainingFile().getVirtualFile();
+          if (session != null && vFile != null) {
             session.getProcess().getManagerThread().schedule(new DebuggerCommandImpl() {
               @Override
               protected void action() throws Exception {
                 StackFrameProxyImpl proxy = context.getFrameProxy();
                 Location location = proxy != null ? proxy.location() : null;
                 if (location != null) {
-                  VirtualFile vFile = item.getContainingFile().getVirtualFile();
-                  if (vFile != null) {
-                    DebuggerUtilsEx.setAlternativeSourceUrl(location.declaringType().name(), vFile.getUrl(), project);
-                  }
+                  DebuggerUtilsEx.setAlternativeSourceUrl(location.declaringType().name(), vFile.getUrl(), project);
                 }
                 DebuggerUIUtil.invokeLater(new Runnable() {
                   @Override
-- 
GitLab