1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-09 03:37:03 +01:00

Huawei: Fix NPE when notification has no body

This commit is contained in:
José Rebelo 2024-08-08 23:30:52 +01:00
parent be3f8375f9
commit c06e22b85e

View File

@ -21,8 +21,6 @@ import org.slf4j.LoggerFactory;
import java.util.List; import java.util.List;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiPacket; import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiPacket;
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.packets.Notifications; import nodomain.freeyourgadget.gadgetbridge.devices.huawei.packets.Notifications;
import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec;
@ -64,7 +62,7 @@ public class SendNotificationRequest extends Request {
title = notificationSpec.sourceName; title = notificationSpec.sourceName;
String body = notificationSpec.body; String body = notificationSpec.body;
if (body.length() > supportProvider.getHuaweiCoordinator().getContentLength()) { if (body != null && body.length() > supportProvider.getHuaweiCoordinator().getContentLength()) {
body = notificationSpec.body.substring(0x0, supportProvider.getHuaweiCoordinator().getContentLength() - 0xD); body = notificationSpec.body.substring(0x0, supportProvider.getHuaweiCoordinator().getContentLength() - 0xD);
body += "..."; body += "...";
} }