Skip to content

Commit c252997

Browse files
committed
StudentCard: Null safety for getter and setter of the student image
1 parent 696da12 commit c252997

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/lithium/openstud/driver/core/models/StudentCard.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@ public void setIssueDate(LocalDateTime issueDate) {
4747
}
4848

4949
public byte[] getImage() {
50+
if (imageBase64 == null) return null;
5051
return Base64.decodeBase64(imageBase64.getBytes());
5152
}
5253

5354
public void setImage(byte[] image) {
54-
imageBase64 = new String(Base64.encodeBase64(image));
55+
if (image == null) imageBase64 = null;
56+
else imageBase64 = new String(Base64.encodeBase64(image));
5557
}
5658

5759
@Override

0 commit comments

Comments
 (0)