fix(companion): guard null _serial in contact overwrite and full callbacks

This commit is contained in:
anders-dc committed 2026-11-08 11:01:05 +01:00
1 parent 056d264c63
commit 9fd02ff3bc
1 file changed
+2 -2
+2 -2
View File
@@ -341,7 +341,7 @@ uint8_t MyMesh::getAutoAddMaxHops() const {
void MyMesh::onContactOverwrite(const uint8_t* pub_key) {
_store->deleteBlobByKey(pub_key, PUB_KEY_SIZE); // delete from storage
if (_serial->isConnected()) {
if (_serial && _serial->isConnected()) {
out_frame[0] = PUSH_CODE_CONTACT_DELETED;
memcpy(&out_frame[1], pub_key, PUB_KEY_SIZE);
_serial->writeFrame(out_frame, 1 + PUB_KEY_SIZE);
@@ -349,7 +349,7 @@ void MyMesh::onContactOverwrite(const uint8_t* pub_key) {
}
void MyMesh::onContactsFull() {
if (_serial->isConnected()) {
if (_serial && _serial->isConnected()) {
out_frame[0] = PUSH_CODE_CONTACTS_FULL;
_serial->writeFrame(out_frame, 1);
}