mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-20 15:35:24 +02:00
Fix for 186105: NPE in CReconciler on Save and other potential NPEs
This commit is contained in:
parent
1a052de39a
commit
88e04c3498
3 changed files with 8 additions and 2 deletions
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* 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 ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
|
||||||
final IEditorInput editorInput = editor.getEditorInput();
|
final IEditorInput editorInput = editor.getEditorInput();
|
||||||
final IWorkingCopy workingCopy = CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(editorInput);
|
final IWorkingCopy workingCopy = CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(editorInput);
|
||||||
|
if (workingCopy == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
final ICElement[] elements = workingCopy.getChildren();
|
final ICElement[] elements = workingCopy.getChildren();
|
||||||
final Integer[] elementOffsets = createSourceIndexes(elements);
|
final Integer[] elementOffsets = createSourceIndexes(elements);
|
||||||
|
|
|
@ -433,7 +433,7 @@ public class CReconciler extends MonoReconciler {
|
||||||
IEditorInput input= fTextEditor.getEditorInput();
|
IEditorInput input= fTextEditor.getEditorInput();
|
||||||
IWorkingCopyManager manager= CUIPlugin.getDefault().getWorkingCopyManager();
|
IWorkingCopyManager manager= CUIPlugin.getDefault().getWorkingCopyManager();
|
||||||
IWorkingCopy copy= manager.getWorkingCopy(input);
|
IWorkingCopy copy= manager.getWorkingCopy(input);
|
||||||
if (copy.getOriginalElement().equals(element)) {
|
if (copy == null || copy.getOriginalElement().equals(element)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return isRelevantProject(copy.getCProject());
|
return isRelevantProject(copy.getCProject());
|
||||||
|
|
|
@ -109,6 +109,9 @@ public class CContentAssistInvocationContext extends ContentAssistInvocationCont
|
||||||
|
|
||||||
fCNComputed = true;
|
fCNComputed = true;
|
||||||
|
|
||||||
|
if (fTU == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
int offset = getParseOffset();
|
int offset = getParseOffset();
|
||||||
if (offset < 0) return null;
|
if (offset < 0) return null;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue