crosshair: prevent crash from command usage in headless mode

This commit is contained in:
Darryl L. Miles 2026-07-21 19:33:16 +01:00 committed by R. Timothy Edwards
parent 1f5e6e6b4d
commit 3f1747b1fb
2 changed files with 5 additions and 1 deletions

View File

@ -3819,7 +3819,8 @@ CmdCrosshair(
TxError("Usage: %s off|x y \n", cmd->tx_argv[0]);
return;
}
DBWSetCrosshair(w, &pos);
if (w)
DBWSetCrosshair(w, &pos);
}

View File

@ -558,6 +558,9 @@ DBWSetCrosshair(window, pos)
MagWindow *window;
Point *pos; /* New crosshair location in coords of rootDef. */
{
assert(window);
assert(pos);
bool needUpdate = FALSE;
if (WINDOW_DEF(window) != curCrosshair.def) needUpdate = TRUE;