Skip to content

Commit 11c5a25

Browse files
subyssurendran666noopur2507
authored andcommitted
NPE in SmartTypingConfigurationBlock when no Java editor is active
The Typing preference page threw an NPE when opened with no active Java editor, since a null compilation unit was dereferenced without a check; this adds the missing null guard, consistent with the existing null-safe handling right below it. Fix: #3068
1 parent 44d377a commit 11c5a25

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/SmartTypingConfigurationBlock.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ private void addAutoclosingSection(Composite composite) {
232232
createDependency(master, slave);
233233

234234
ICompilationUnit cu= getCompilationUnit();
235-
IJavaProject project= cu.getJavaProject();
235+
IJavaProject project= cu != null ? cu.getJavaProject() : null;
236236
String compliance= project != null
237237
? project.getOption(JavaCore.COMPILER_COMPLIANCE, true)
238238
: JavaCore.getOption(JavaCore.COMPILER_COMPLIANCE);

0 commit comments

Comments
 (0)