1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-25 01:05:27 +03:00

Fix custom box names (#13935)

* Fix custom box names

* Review ledvinap
This commit is contained in:
Mark Haslinghuis 2024-09-30 16:11:06 +02:00 committed by GitHub
parent a7672a0a1e
commit 713ba21407
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -142,12 +142,15 @@ int serializeBoxNameFn(sbuf_t *dst, const box_t *box)
const char* name = NULL;
int len;
#if defined(USE_CUSTOM_BOX_NAMES)
if (name == NULL
&& box->boxId >= BOXUSER1 && box->boxId <= BOXUSER4) {
if (box->boxId >= BOXUSER1 && box->boxId <= BOXUSER4) {
const int n = box->boxId - BOXUSER1;
name = modeActivationConfig()->box_user_names[n];
// possibly there is no '\0' in boxname
len = strnlen(name, sizeof(modeActivationConfig()->box_user_names[0]));
if (*name) {
len = strnlen(name, sizeof(modeActivationConfig()->box_user_names[n]));
} else {
name = NULL;
}
}
#endif
if (name == NULL) {