In debug builds, initialize newmenu_item type,text to poison values

This improves the chance that an unset value will abort rather than
displaying strange results.  Release builds are unchanged.
This commit is contained in:
Kp 2021-06-28 03:37:51 +00:00
parent 86e8e1d4f9
commit 13e29c64f3

View file

@ -209,13 +209,21 @@ public:
? &nm_private.input
: nullptr;
}
char *text; // The text associated with this item.
char *text
#ifndef NDEBUG
= reinterpret_cast<char *>(UINTPTR_MAX);
#endif
; // The text associated with this item.
int value; // For checkboxes and radio buttons, this is 1 if marked initially, else 0
// The rest of these are used internally by by the menu system, so don't set 'em!!
short x, y;
short w, h;
uint8_t right_offset;
nm_type type; // What kind of item this is, see NM_TYPE_????? defines
nm_type type
#ifndef NDEBUG
= static_cast<nm_type>(UINT8_MAX);
#endif
; // What kind of item this is, see NM_TYPE_????? defines
union nm_type_specific_data {
nm_type_specific_data() :
input{{nullptr, 0, 0}}