fix a null pointer dereference

spotted by coverity, also I reproduced it once with command like
`wesnoth --render-image foo.png`