mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-24 22:07: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:
parent
7755ae5be4
commit
33e5903e80
@ -86,8 +86,10 @@ public class CommandStyleImport extends SingleLineCommand2<TitledDiagram> {
|
|||||||
if (path.startsWith("http://") || path.startsWith("https://")) {
|
if (path.startsWith("http://") || path.startsWith("https://")) {
|
||||||
SURL url = SURL.create(path);
|
SURL url = SURL.create(path);
|
||||||
try (InputStream remoteInputStream = url.openStream()) {
|
try (InputStream remoteInputStream = url.openStream()) {
|
||||||
|
if (remoteInputStream != null) {
|
||||||
lines = BlocLines.load(remoteInputStream, location);
|
lines = BlocLines.load(remoteInputStream, location);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
final SFile styleFile = FileSystem.getInstance().getFile(path);
|
final SFile styleFile = FileSystem.getInstance().getFile(path);
|
||||||
if (styleFile.exists()) {
|
if (styleFile.exists()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user