diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java index 4b2c469785b..acdf0c1e717 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java @@ -2666,12 +2666,14 @@ public boolean isStillLocked() { public boolean isStillLockedForIngest() { - Dataset testDataset = datasetService.find(dataset.getId()); - if (testDataset != null && testDataset.getId() != null) { - logger.log(Level.FINE, "checking lock status of dataset {0}", dataset.getId()); - - if (testDataset.getLockFor(DatasetLock.Reason.Ingest) != null) { - return true; + if (dataset.getId() != null) { + Dataset testDataset = datasetService.find(dataset.getId()); + if (testDataset != null && testDataset.getId() != null) { + logger.log(Level.FINE, "checking lock status of dataset {0}", dataset.getId()); + + if (testDataset.getLockFor(DatasetLock.Reason.Ingest) != null) { + return true; + } } } return false; @@ -2690,16 +2692,17 @@ public boolean isLocked() { return false; } - public boolean isLockedForIngest(){ - - Dataset testDataset = datasetService.find(dataset.getId()); - if (stateChanged) { - return false; - } - - if (testDataset != null) { - if (testDataset.getLockFor(DatasetLock.Reason.Ingest) != null) { - return true; + public boolean isLockedForIngest() { + if (dataset.getId() != null) { + Dataset testDataset = datasetService.find(dataset.getId()); + if (stateChanged) { + return false; + } + + if (testDataset != null) { + if (testDataset.getLockFor(DatasetLock.Reason.Ingest) != null) { + return true; + } } } return false;