Skip to content

Commit 474aa92

Browse files
committed
fix: addressing coderabbit point about NPE
1 parent 43658c1 commit 474aa92

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/nvs/handlers/NvsEditorHandler.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,21 @@ public Object execute(ExecutionEvent event) throws ExecutionException
3333
new NvsTableDataService().saveCsv(csvFile, new ArrayList<>());
3434
}
3535

36-
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
37-
if (page != null)
36+
var window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
37+
if (window != null)
3838
{
39-
try
39+
IWorkbenchPage page = window.getActivePage();
40+
if (page != null)
4041
{
41-
FileEditorInput input = new FileEditorInput(csvFile);
42-
page.openEditor(input, NvsEditor.ID);
43-
}
44-
catch (PartInitException e)
45-
{
46-
Logger.log(e);
42+
try
43+
{
44+
FileEditorInput input = new FileEditorInput(csvFile);
45+
page.openEditor(input, NvsEditor.ID);
46+
}
47+
catch (PartInitException e)
48+
{
49+
Logger.log(e);
50+
}
4751
}
4852
}
4953

0 commit comments

Comments
 (0)