1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 00:45:28 +02:00

Bug 342791 - NPE in debug expression hover - null frame context

Patch by Kirk Beitz
This commit is contained in:
Anton Leherbauer 2011-04-14 08:19:56 +00:00
parent db23381d3e
commit 536ce267ee

View file

@ -129,6 +129,10 @@ abstract public class AbstractDsfDebugTextHover extends AbstractDebugTextHover i
@Override @Override
protected String evaluateExpression(String expression) { protected String evaluateExpression(String expression) {
IFrameDMContext frame = getFrame(); IFrameDMContext frame = getFrame();
if (frame == null) {
return null;
}
String sessionId = frame.getSessionId(); String sessionId = frame.getSessionId();
DsfServicesTracker dsfServicesTracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), sessionId); DsfServicesTracker dsfServicesTracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), sessionId);
try { try {
@ -191,14 +195,14 @@ abstract public class AbstractDsfDebugTextHover extends AbstractDebugTextHover i
public IInformationControlCreator getHoverControlCreator() { public IInformationControlCreator getHoverControlCreator() {
if (useExpressionExplorer()) { if (useExpressionExplorer()) {
return createExpressionInformationControlCreator(); return createExpressionInformationControlCreator();
} else { }
return new IInformationControlCreator() { return new IInformationControlCreator() {
public IInformationControl createInformationControl(Shell parent) { public IInformationControl createInformationControl(Shell parent) {
return new DefaultInformationControl(parent, EditorsUI.getTooltipAffordanceString()); return new DefaultInformationControl(parent, EditorsUI.getTooltipAffordanceString());
} }
}; };
} }
}
/* /*
* @see org.eclipse.jface.text.ITextHoverExtension2#getHoverInfo2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion) * @see org.eclipse.jface.text.ITextHoverExtension2#getHoverInfo2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
@ -214,7 +218,9 @@ abstract public class AbstractDsfDebugTextHover extends AbstractDebugTextHover i
text= getExpressionText(textViewer, hoverRegion); text= getExpressionText(textViewer, hoverRegion);
if (text != null && text.length() > 0) { if (text != null && text.length() > 0) {
final IFrameDMContext frameDmc = getFrame(); final IFrameDMContext frameDmc = getFrame();
if (frameDmc != null) {
final DsfSession dsfSession = DsfSession.getSession(frameDmc.getSessionId()); final DsfSession dsfSession = DsfSession.getSession(frameDmc.getSessionId());
if (dsfSession != null) {
Callable<IExpressionDMContext> callable = new Callable<IExpressionDMContext>() { Callable<IExpressionDMContext> callable = new Callable<IExpressionDMContext>() {
public IExpressionDMContext call() throws Exception { public IExpressionDMContext call() throws Exception {
DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), frameDmc.getSessionId()); DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), frameDmc.getSessionId());
@ -235,6 +241,8 @@ abstract public class AbstractDsfDebugTextHover extends AbstractDebugTextHover i
} catch (ExecutionException e) { } catch (ExecutionException e) {
} }
} }
}
}
return null; return null;
} }