Fixed a NPE when an invalid repair material was entered

#1484