1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fix for 186105: NPE in CReconciler on Save and other potential NPEs

This commit is contained in:
Anton Leherbauer 2007-05-09 10:52:30 +00:00
parent 1a052de39a
commit 88e04c3498
3 changed files with 8 additions and 2 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2006 IBM Corporation and others.
* Copyright (c) 2005, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -85,6 +85,9 @@ public class GoToNextPreviousMemberAction extends TextEditorAction {
final ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
final IEditorInput editorInput = editor.getEditorInput();
final IWorkingCopy workingCopy = CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(editorInput);
if (workingCopy == null) {
return;
}
try {
final ICElement[] elements = workingCopy.getChildren();
final Integer[] elementOffsets = createSourceIndexes(elements);

View file

@ -433,7 +433,7 @@ public class CReconciler extends MonoReconciler {
IEditorInput input= fTextEditor.getEditorInput();
IWorkingCopyManager manager= CUIPlugin.getDefault().getWorkingCopyManager();
IWorkingCopy copy= manager.getWorkingCopy(input);
if (copy.getOriginalElement().equals(element)) {
if (copy == null || copy.getOriginalElement().equals(element)) {
return false;
}
return isRelevantProject(copy.getCProject());

View file

@ -109,6 +109,9 @@ public class CContentAssistInvocationContext extends ContentAssistInvocationCont
fCNComputed = true;
if (fTU == null) {
return null;
}
int offset = getParseOffset();
if (offset < 0) return null;