Added null checks to whitespace trimming code to fix provisioning UI.