Fix NPE when array is null

Don't crash with a NPE when the expected array is actually null, just return null.