mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-18 06:37:47 +01: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 ?
|
if (iteration > 8) { // limit ?
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
calendar.setTimeInMillis(calendarEvent.getBegin());
|
calendar.setTimeInMillis(calendarEvent.getBegin());
|
||||||
byte[] title = calendarEvent.getTitle().getBytes();
|
byte[] title;
|
||||||
byte[] body = calendarEvent.getDescription().getBytes();
|
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;
|
int length = 18 + title.length + 1 + body.length + 1;
|
||||||
ByteBuffer buf = ByteBuffer.allocate(length);
|
ByteBuffer buf = ByteBuffer.allocate(length);
|
||||||
|
Loading…
Reference in New Issue
Block a user