Fix headless segfault on win32.
Merge pull request #467 from unknownbrackets/master

Fix headless segfault on win32