| Summary: | MinMax addon throws NPE when no perspective is available | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Kai Toedter <kai.toedter> |
| Component: | UI | Assignee: | Christoph Laeubrich <laeubi> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | laeubi, Lars.Vogel, ma.becker, remy.suen |
| Version: | 4.2 | ||
| Target Milestone: | 4.14 M1 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| See Also: |
https://git.eclipse.org/r/149942 https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=7f617ce6fdb4be8f151d192ac1dadde271445913 |
||
| Whiteboard: | |||
(In reply to comment #0) > private SideValue getCachedBar(MUIElement element) { > MPerspective persp = modelService.getPerspectiveFor(element); > if (persp == null) > return null; Indeed, see bug 365192. > I could commit that myself, but I would like Eric to review the fix :) Eric, could you take a look at this? Even tough the code has changed in the past 8 years, the problem (and similar missing null checks) still persist. I'll provide a patch for this, would be good if someone can review it then. New Gerrit change created: https://git.eclipse.org/r/149942 (In reply to Kai Toedter from comment #0) > Perspectives are optional in the Workbench model. The MinMax addon throws an > NPE, when no perspective is available. Fixes: > > Project org.eclipse.e4.ui.workbench.addons.swt > Class MinMaxAddon.java > > private int getCachedIndex(MUIElement element) { > MPerspective persp = modelService.getPerspectiveFor(element); > if (persp == null) > return -1; > ... > > private SideValue getCachedBar(MUIElement element) { > MPerspective persp = modelService.getPerspectiveFor(element); > if (persp == null) > return null; > ... > > I could commit that myself, but I would like Eric to review the fix :) How can I reproduce this NPE? What steps do I need to perform? Gerrit change https://git.eclipse.org/r/149942 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=7f617ce6fdb4be8f151d192ac1dadde271445913 Thanks Christoph for fixing this very old bug. |
Perspectives are optional in the Workbench model. The MinMax addon throws an NPE, when no perspective is available. Fixes: Project org.eclipse.e4.ui.workbench.addons.swt Class MinMaxAddon.java private int getCachedIndex(MUIElement element) { MPerspective persp = modelService.getPerspectiveFor(element); if (persp == null) return -1; ... private SideValue getCachedBar(MUIElement element) { MPerspective persp = modelService.getPerspectiveFor(element); if (persp == null) return null; ... I could commit that myself, but I would like Eric to review the fix :)