#12 -- Fix NPE

This commit is contained in:
Anton Romanov 2021-04-12 11:01:59 +04:00
parent 1b468746da
commit 797718ddc3
2 changed files with 7 additions and 3 deletions

View File

@ -91,6 +91,10 @@ public class Commit extends BaseEntity {
} }
public boolean containsEntity() { public boolean containsEntity() {
return fileChanges.stream().anyMatch(FileChange::isContainsEntity); return fileChanges != null && fileChanges.stream().anyMatch(
fileChange -> fileChange != null
&& fileChange.isContainsEntity() != null
&& fileChange.isContainsEntity()
);
} }
} }

View File

@ -25,7 +25,7 @@ public class FileChange extends BaseEntity {
@Transient @Transient
private boolean added; private boolean added;
private boolean containsEntity; private Boolean containsEntity;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "file_change_id", unique = true) @JoinColumn(name = "file_change_id", unique = true)
@ -79,7 +79,7 @@ public class FileChange extends BaseEntity {
return added; return added;
} }
public boolean isContainsEntity() { public Boolean isContainsEntity() {
return containsEntity; return containsEntity;
} }