Make sure the array exists before adding an element to it. props rodrigosprimo. fixes #23272.