Make recalculate_sizes() handle an empty window with no active