mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-08-26 01:00:52 +02:00
Huami: Fix crash when calendar event desctription or title was null
Fixes #1813
This commit is contained in:
parent
a2d52438e2
commit
8cf7e259aa
@ -1727,9 +1727,20 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
|
||||
if (iteration > 8) { // limit ?
|
||||
break;
|
||||
}
|
||||
|
||||
calendar.setTimeInMillis(calendarEvent.getBegin());
|
||||
byte[] title = calendarEvent.getTitle().getBytes();
|
||||
byte[] body = calendarEvent.getDescription().getBytes();
|
||||
byte[] title;
|
||||
byte[] body;
|
||||
if (calendarEvent.getTitle() != null) {
|
||||
title = calendarEvent.getTitle().getBytes();
|
||||
} else {
|
||||
title = new byte[]{};
|
||||
}
|
||||
if (calendarEvent.getDescription() != null) {
|
||||
body = calendarEvent.getDescription().getBytes();
|
||||
} else {
|
||||
body = new byte[]{};
|
||||
}
|
||||
|
||||
int length = 18 + title.length + 1 + body.length + 1;
|
||||
ByteBuffer buf = ByteBuffer.allocate(length);
|
||||
|
Loading…
Reference in New Issue
Block a user