Skip to content

Commit d54a9eb

Browse files
committed
[#2121] NPE in PreferencePage.performOk() caused by null values.
* use empty `String` instead of `null`
1 parent 8998df3 commit d54a9eb

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • terminal/bundles/org.eclipse.terminal.view.ui/src/org/eclipse/terminal/view/ui/internal/preferences

terminal/bundles/org.eclipse.terminal.view.ui/src/org/eclipse/terminal/view/ui/internal/preferences/PreferencePage.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,16 +649,16 @@ public boolean performOk() {
649649
String text = command.getText();
650650
IPath p = new Path(text.trim());
651651
UIPlugin.getScopedPreferences().setValue(IPreferenceKeys.PREF_LOCAL_TERMINAL_DEFAULT_SHELL_UNIX,
652-
p.toFile().isFile() && p.toFile().canRead() && p.toFile().canExecute() ? p.toOSString() : null);
652+
p.toFile().isFile() && p.toFile().canRead() && p.toFile().canExecute() ? p.toOSString() : ""); //$NON-NLS-1$
653653

654654
text = arguments.getText();
655655
UIPlugin.getScopedPreferences().setValue(IPreferenceKeys.PREF_LOCAL_TERMINAL_DEFAULT_SHELL_UNIX_ARGS,
656-
!"".equals(text.trim()) ? text.trim() : null); //$NON-NLS-1$
656+
!"".equals(text.trim()) ? text.trim() : ""); //$NON-NLS-1$ //$NON-NLS-2$
657657
}
658658

659659
String text = workingDir.getText();
660660
if (text == null || Messages.PreferencePage_workingDir_userhome_label.equals(text) || "".equals(text.trim())) { //$NON-NLS-1$
661-
UIPlugin.getScopedPreferences().setValue(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD, null);
661+
UIPlugin.getScopedPreferences().setValue(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD, ""); //$NON-NLS-1$
662662
} else if (Messages.PreferencePage_workingDir_eclipsehome_label.equals(text)) {
663663
UIPlugin.getScopedPreferences().setValue(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD,
664664
IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_HOME);
@@ -673,7 +673,7 @@ public boolean performOk() {
673673

674674
IPath p = new Path(resolved);
675675
UIPlugin.getScopedPreferences().setValue(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD,
676-
p.toFile().canRead() && p.toFile().isDirectory() ? text.trim() : null);
676+
p.toFile().canRead() && p.toFile().isDirectory() ? text.trim() : ""); //$NON-NLS-1$
677677
} catch (CoreException e) {
678678
if (Platform.inDebugMode()) {
679679
UIPlugin.getDefault().getLog().log(e.getStatus());

0 commit comments

Comments
 (0)