1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2026-03-20 03:49:43 +00:00

Fix number_dialog_help when ptr is null

Dereferencing a null pointer is undefined behavior even if you don't use the
result.
This commit is contained in:
Joseph C. Sible
2025-09-08 19:42:49 -04:00
parent c913adae0e
commit b18c7e78e6

View File

@@ -1370,7 +1370,6 @@ EX namespace dialog {
};
void number_dialog_help :: operator() () {
auto ne = *ptr;
init("number dialog help");
dialog::addBreak(100);
dialog::addHelp(XLAT("You can enter formulas in this dialog."));
@@ -1380,7 +1379,7 @@ EX namespace dialog {
dialog::addBreak(100);
dialog::addHelp(XLAT("Constants and variables available:"));
addHelp(available_constants());
if(ptr && ne.animatable) {
if(ptr && ptr->animatable) {
dialog::addBreak(100);
dialog::addHelp(XLAT("Animations:"));
dialog::addHelp(XLAT("a..b -- animate linearly from a to b"));
@@ -1395,7 +1394,7 @@ EX namespace dialog {
#if CAP_ANIMATIONS
dialog::addBreak(50);
auto f = find_edit(!ptr ? nullptr : ne.intval ? (void*) ne.intval : (void*) ne.editwhat);
auto f = find_edit(!ptr ? nullptr : ptr->intval ? (void*) ptr->intval : (void*) ptr->editwhat);
if(f)
dialog::addHelp(XLAT("Parameter names, e.g. '%1'", f->name));
else