Skip to content

Commit 05dbefe

Browse files
committed
fix NPE for JavaModel
1 parent 0c9e04b commit 05dbefe

1 file changed

Lines changed: 23 additions & 22 deletions

File tree

key.core/src/main/java/de/uka/ilkd/key/proof/io/OutputStreamProofSaver.java

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -231,35 +231,36 @@ private String makePathsRelative(Path basePath, KeyAst.@Nullable Declarations he
231231
header.printDefinitions(out);
232232
}
233233

234-
out.println();
235-
236234
JavaModel jm = proof.getServices().getJavaModel();
237-
Path bootClassPath = jm.getBootClassPath();
238-
if (bootClassPath != null) {
239-
out.printf("\\bootclasspath \"%s\";\n", safePathRelativeTo(bootClassPath, basePath));
240-
}
235+
if (jm != null) {
236+
out.println();
237+
Path bootClassPath = jm.getBootClassPath();
238+
if (bootClassPath != null) {
239+
out.printf("\\bootclasspath \"%s\";\n",
240+
safePathRelativeTo(bootClassPath, basePath));
241+
}
241242

242-
List<Path> classPath = jm.getClassPath();
243-
if (classPath != null && !classPath.isEmpty()) {
244-
for (Path path : classPath) {
245-
out.printf("\\classpath \"%s\";\n", safePathRelativeTo(path, basePath));
243+
List<Path> classPath = jm.getClassPath();
244+
if (classPath != null && !classPath.isEmpty()) {
245+
for (Path path : classPath) {
246+
out.printf("\\classpath \"%s\";\n", safePathRelativeTo(path, basePath));
247+
}
246248
}
247-
}
248249

249-
Path javaSource = jm.getModelDir();
250-
if (javaSource != null) {
251-
out.printf("\\javaSource \"%s\";\n", safePathRelativeTo(javaSource, basePath));
252-
}
250+
Path javaSource = jm.getModelDir();
251+
if (javaSource != null) {
252+
out.printf("\\javaSource \"%s\";\n", safePathRelativeTo(javaSource, basePath));
253+
}
253254

254-
List<Path> includedFiles = jm.getIncludedFiles();
255-
if (includedFiles != null && !includedFiles.isEmpty()) {
256-
for (Path includedFile : includedFiles) {
257-
out.printf("\\include \"%s\";\n",
258-
safePathRelativeTo(includedFile, basePath));
255+
List<Path> includedFiles = jm.getIncludedFiles();
256+
if (includedFiles != null && !includedFiles.isEmpty()) {
257+
for (Path includedFile : includedFiles) {
258+
out.printf("\\include \"%s\";\n",
259+
safePathRelativeTo(includedFile, basePath));
260+
}
259261
}
260262
}
261-
262-
return sw.toString()+"\n";
263+
return sw + "\n";
263264
}
264265

265266
private String newNames2Proof(Node n) {

0 commit comments

Comments
 (0)