Fix NPE in toString when constraint is null