Merge "Add nullness check to avoid crashing." into main