1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-24 20:00:33 +00:00

Avoid NPE when a remote input stream cannot be read

Avoids the following stacktrace:
java.lang.NullPointerException
	at java.base/java.io.Reader.<init>(Reader.java:168)
	at java.base/java.io.InputStreamReader.<init>(InputStreamReader.java:88)
	at net.sourceforge.plantuml.utils.BlocLines.load(BlocLines.java:79)
	at net.sourceforge.plantuml.style.CommandStyleImport.executeArg(CommandStyleImport.java:89)
This commit is contained in:
Dietrich Travkin 2024-04-04 17:52:10 +02:00
parent 7755ae5be4
commit 33e5903e80

View File

@ -86,7 +86,9 @@ public class CommandStyleImport extends SingleLineCommand2<TitledDiagram> {
if (path.startsWith("http://") || path.startsWith("https://")) {
SURL url = SURL.create(path);
try (InputStream remoteInputStream = url.openStream()) {
lines = BlocLines.load(remoteInputStream, location);
if (remoteInputStream != null) {
lines = BlocLines.load(remoteInputStream, location);
}
}
} else {
final SFile styleFile = FileSystem.getInstance().getFile(path);