1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-28 15:56:31 +00:00

Merge pull request #1724 from travkin79/patch/fix-NPE

Avoid NPE when a remote input stream cannot be read (while reading a remote style file)
This commit is contained in:
PlantUML 2024-04-06 13:22:10 +02:00 committed by GitHub
commit 06d06e729b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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()) {