Program "crashes" when I setResizable(true) and resize the Window

@svan This is a solution for the problem but in the program I need to use draw() on loop() which breaks the solution. Any other Ideas?