diff --git a/libraries/AP_Common/AP_Var.cpp b/libraries/AP_Common/AP_Var.cpp index c36ade1ac6..53e00fd816 100644 --- a/libraries/AP_Common/AP_Var.cpp +++ b/libraries/AP_Common/AP_Var.cpp @@ -131,9 +131,11 @@ AP_Var::~AP_Var(void) void AP_Var::copy_name(char *buffer, size_t buffer_size) const { buffer[0] = '\0'; - if (_group) - _group->copy_name(buffer, buffer_size); - strlcat_P(buffer, _name, buffer_size); + if (_name) { + if (_group) + _group->copy_name(buffer, buffer_size); + strlcat_P(buffer, _name, buffer_size); + } } // Find a variable by name. diff --git a/libraries/AP_Common/AP_Var_menufuncs.cpp b/libraries/AP_Common/AP_Var_menufuncs.cpp index 217eca7bc9..61d2706cad 100644 --- a/libraries/AP_Common/AP_Var_menufuncs.cpp +++ b/libraries/AP_Common/AP_Var_menufuncs.cpp @@ -111,10 +111,16 @@ AP_Var_menu_show(uint8_t argc, const Menu::arg *argv) for (vp = AP_Var::first(); vp; vp = vp->next()) { char name_buffer[32]; + // groups should not be displayed + if (vp->meta_type_id() == AP_Var::k_typeid_group) { + continue; + } + // get a displayable name for the variable vp->copy_name(name_buffer, sizeof(name_buffer)); if (name_buffer[0] == 0) { - strcpy_P(name_buffer, PSTR("??")); + // without a name the variable is not displayable + continue; } // print name and value