Fixes issue with invalid rendering when setting texture to NULL