How do I resize the Lightmap Array via Editor Script?

I’m using the following code in an editor script to resize the LightmapSettings.lightmaps array:

//resize array based on room count
		LightmapData[] Lightmaps = LightmapSettings.lightmaps;
		print (Lightmaps.Length); // returns 0
		System.Array.Resize (ref Lightmaps, RoomCount);
		print (Lightmaps.Length); // returns 3 (this is correct)
		LightmapSettings.lightmaps = Lightmaps; //NullReferenceException

I got this far from this answer by Mike 3. Any thoughts on why this may not be working?

Maybe null reference because lightmaps array has one or more null elements.