Fixed a crash when the window size is too small