From 4e3672e2af7656fbb338a41650280944ef54c376 Mon Sep 17 00:00:00 2001 From: Jean-Yves Tinevez Date: Sun, 7 Jan 2024 17:29:17 +0100 Subject: [PATCH] Don't crash when saving an imported file without a valid XML file. --- src/main/java/org/mastodon/mamut/io/ProjectLoader.java | 2 +- .../mamut/io/importer/trackmate/TrackMateImporter.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/mastodon/mamut/io/ProjectLoader.java b/src/main/java/org/mastodon/mamut/io/ProjectLoader.java index 1bc43d902..2506f2fb3 100644 --- a/src/main/java/org/mastodon/mamut/io/ProjectLoader.java +++ b/src/main/java/org/mastodon/mamut/io/ProjectLoader.java @@ -374,7 +374,7 @@ static File originalOrBackupDatasetXml( final MamutProject project ) else return copyBackupDatasetXmlToTmpFile( project ); } - catch ( final IOException e ) + catch ( final IOException | NullPointerException e ) { return null; } diff --git a/src/main/java/org/mastodon/mamut/io/importer/trackmate/TrackMateImporter.java b/src/main/java/org/mastodon/mamut/io/importer/trackmate/TrackMateImporter.java index f3bec5ba5..1f273ab6f 100644 --- a/src/main/java/org/mastodon/mamut/io/importer/trackmate/TrackMateImporter.java +++ b/src/main/java/org/mastodon/mamut/io/importer/trackmate/TrackMateImporter.java @@ -86,6 +86,7 @@ import org.mastodon.feature.FeatureSpecsService; import org.mastodon.mamut.io.importer.ModelImporter; import org.mastodon.mamut.io.project.MamutProject; +import org.mastodon.mamut.io.project.MamutProjectIO; import org.mastodon.mamut.model.Link; import org.mastodon.mamut.model.Model; import org.mastodon.mamut.model.ModelGraph; @@ -161,8 +162,7 @@ public MamutProject createProject() throws IOException imageFile = makDummyImage( imageDataEl ); } } - - final MamutProject project = new MamutProject( null, imageFile ); + final MamutProject project = MamutProjectIO.fromBdvFile( imageFile ); // Set project time and space units final Element modelEl = root.getChild( MODEL_TAG );