SOLR-5509: fix possible npe

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1546189 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-11-27 20:43:35 +00:00
parent 2939fce489
commit e54b08e2ab
1 changed files with 10 additions and 8 deletions

View File

@ -109,14 +109,16 @@ public class AddUpdateCommand extends UpdateCommand implements Iterable<IndexDoc
} }
public String getPrintableId() { public String getPrintableId() {
IndexSchema schema = req.getSchema(); if (req != null) {
SchemaField sf = schema.getUniqueKeyField(); IndexSchema schema = req.getSchema();
if (solrDoc != null && sf != null) { SchemaField sf = schema.getUniqueKeyField();
SolrInputField field = solrDoc.getField(sf.getName()); if (solrDoc != null && sf != null) {
if (field != null) { SolrInputField field = solrDoc.getField(sf.getName());
return field.getFirstValue().toString(); if (field != null) {
} return field.getFirstValue().toString();
} }
}
}
return "(null)"; return "(null)";
} }