Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Error in CView

This patch fixing a problem in CView.java (bug causes nullpointerexception
when user switches context).

Index: CView.java
===================================================================
RCS file:
/home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.j
ava,v
retrieving revision 1.2
diff -u -r1.2 CView.java
--- CView.java 21 Aug 2002 01:06:51 -0000 1.2
+++ CView.java 26 Aug 2002 21:04:15 -0000
@@ -998,11 +998,13 @@
    IEditorReference[] editorReferences = page.getEditorReferences();
    for (int i = 0; i < editorReferences.length; ++i) {
     IEditorPart editor = editorReferences[i].getEditor(false);
-    IEditorInput input = editor.getEditorInput();
-    if (input instanceof IFileEditorInput
-    && file.equals(((IFileEditorInput)input).getFile())) {
-     page.bringToTop(editor);
-     return;
+    if(null != editor) {
+     IEditorInput input = editor.getEditorInput();
+     if (input instanceof IFileEditorInput
+     && file.equals(((IFileEditorInput)input).getFile())) {
+      page.bringToTop(editor);
+      return;
+     }
     }
    }
   } else if (obj instanceof ICElement) {
@@ -1014,15 +1016,17 @@
    IEditorReference editorReferences[] = page.getEditorReferences();
    for (int i = 0; i < editorReferences.length; ++i) {
     IEditorPart editor = editorReferences[i].getEditor(false);
-    IEditorInput input = editor.getEditorInput();
-    if (input instanceof IFileEditorInput
-    && res.equals(((IFileEditorInput)input).getFile())) {
-     page.bringToTop(editor);
-     if (editor instanceof CEditor) {
-      CEditor e = (CEditor)editor;
-      e.selectionChanged (new SelectionChangedEvent (e.getOutlinePage (),
selection));
+    if(null != editor) {
+     IEditorInput input = editor.getEditorInput();
+     if (input instanceof IFileEditorInput
+     && res.equals(((IFileEditorInput)input).getFile())) {
+      page.bringToTop(editor);
+      if (editor instanceof CEditor) {
+       CEditor e = (CEditor)editor;
+       e.selectionChanged (new SelectionChangedEvent (e.getOutlinePage (),
selection));
+      }
+      return;
      }
-     return;
     }
    }

====================================================

Alex Chapiro



Back to the top