Browse Source

avoid NPE when launching and a session somehow exists

tags/v1.4.16^0
Jonathan Cobb 4 years ago
parent
commit
eaa2c68f2f
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      bubble-server/src/main/java/bubble/dao/cloud/CloudServiceDAO.java

+ 4
- 1
bubble-server/src/main/java/bubble/dao/cloud/CloudServiceDAO.java View File

@@ -21,6 +21,7 @@ import org.springframework.stereotype.Repository;


import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -123,7 +124,9 @@ public class CloudServiceDAO extends AccountOwnedTemplateDAO<CloudService> {
} }


public List<CloudService> findByFirstAdminAndType(CloudServiceType csType) { public List<CloudService> findByFirstAdminAndType(CloudServiceType csType) {
return findByFields("account", accountDAO.getFirstAdmin().getUuid(), "type", csType, "enabled", true);
final Account firstAdmin = accountDAO.getFirstAdmin();
if (firstAdmin == null) return new ArrayList<>();
return findByFields("account", firstAdmin.getUuid(), "type", csType, "enabled", true);
} }


public boolean adminHasType(CloudServiceType csType) { public boolean adminHasType(CloudServiceType csType) {


Loading…
Cancel
Save