cid#1596251 Dereference null return value
and cid#1596249 Dereference null return value Change-Id: I2d50e8be5ec20001527c20ccd46a9a0336792d8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165871 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
+8
-3
@@ -342,11 +342,16 @@ public class ScriptEditorForBeanShell extends ScriptEditorBase implements Action
|
||||
String s = view.getText();
|
||||
fos = scriptURL.openConnection().getOutputStream();
|
||||
|
||||
if (fos != null) {
|
||||
if (fos != null && s != null) {
|
||||
fos.write(s.getBytes());
|
||||
} else {
|
||||
showErrorMessage(
|
||||
"Error saving script: Could not open stream for file");
|
||||
if (fos == null) {
|
||||
showErrorMessage(
|
||||
"Error saving script: Could not open stream for file");
|
||||
} else {
|
||||
showErrorMessage(
|
||||
"Error saving script: Could not get script text");
|
||||
}
|
||||
result = false;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -109,7 +109,8 @@ public class ScriptSourceModel {
|
||||
Object result;
|
||||
|
||||
if (view.isModified()) {
|
||||
result = interpreter.eval(view.getText());
|
||||
String s = view.getText();
|
||||
result = interpreter.eval(s != null ? s : "");
|
||||
} else {
|
||||
result = interpreter.eval(getText());
|
||||
}
|
||||
@@ -122,4 +123,4 @@ public class ScriptSourceModel {
|
||||
currentPosition = lineNum - 1;
|
||||
view.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user