Fix crash bug in object dialogs

Signed-off-by: nppangband <nppangbanddev@verizon.net>