mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
MergeableLineMarkerInfo: removing assert on nullable element in LineMarkerInfo
because actually it could be `null` if gutter outlasts the element it was put on (EA-119661) IDEA-CR-32349
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.daemon;
|
||||
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.editor.markup.GutterIconRenderer;
|
||||
import com.intellij.openapi.ui.popup.IPopupChooserBuilder;
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
@@ -144,11 +145,16 @@ public abstract class MergeableLineMarkerInfo<T extends PsiElement> extends Line
|
||||
icon = renderer.getIcon();
|
||||
}
|
||||
PsiElement element = ((LineMarkerInfo)dom).getElement();
|
||||
assert element != null;
|
||||
final String elementPresentation =
|
||||
dom instanceof MergeableLineMarkerInfo
|
||||
? ((MergeableLineMarkerInfo)dom).getElementPresentation(element)
|
||||
: element.getText();
|
||||
final String elementPresentation;
|
||||
if (element == null) {
|
||||
elementPresentation = IdeBundle.message("node.structureview.invalid");
|
||||
}
|
||||
else if (dom instanceof MergeableLineMarkerInfo) {
|
||||
elementPresentation = ((MergeableLineMarkerInfo)dom).getElementPresentation(element);
|
||||
}
|
||||
else {
|
||||
elementPresentation = element.getText();
|
||||
}
|
||||
String text = StringUtil.first(elementPresentation, 100, true).replace('\n', ' ');
|
||||
|
||||
final JBLabel label = new JBLabel(text, icon, SwingConstants.LEFT);
|
||||
|
||||
Reference in New Issue
Block a user