fix a null pointer dereference

spotted by coverity, also I reproduced it once with command like
`wesnoth --render-image foo.png`
Merge pull request #2 from cbeck88/master

fix a null pointer dereference