Fix REST API errors caused by invalid custom field data
PR https://github.com/mantisbt/mantisbt/pull/1622