Fixed crash when changing display modes

- Issue: https://github.com/sgminer-dev/sgminer/issues/237