Skip to content

Commit 50b68c8

Browse files
committed
ScriptInfo: use null version for missing scripts
If a script file does not actually exist, we cannot hash its contents nor obtain a last modified timestamp. So we return null for the version. This avoids a nasty exception dump on the log in ScriptInfoTest.
1 parent c746bb6 commit 50b68c8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/main/java/org/scijava/script/ScriptInfo.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ public String getLocation() {
295295
@Override
296296
public String getVersion() {
297297
final File file = new File(path);
298+
if (!file.exists()) return null; // no version for non-existent script
298299
final Date lastModified = FileUtils.getModifiedTime(file);
299300
final String datestamp =
300301
new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss").format(lastModified);

0 commit comments

Comments
 (0)