Protect against another replace.cmd NPE

I missed a spot where the ReplaceRequest cmd field can be null.
If its null, the command obviously failed to be prepared and must
be skipped, causing the overall push to reject.

Change-Id: Ib3011ea9393287a46aa01fd486d83fedb043d83f
This commit is contained in:
Shawn O. Pearce
2012-08-09 14:17:08 -07:00
parent 1bd96783b3
commit e0f21a5623

View File

@@ -613,10 +613,10 @@ public class ReceiveCommits {
if (replace.inputCommand == newChange) {
replaceCount++;
if (replace.cmd.getResult() == OK) {
if (replace.cmd != null && replace.cmd.getResult() == OK) {
okToInsert++;
}
} else if (replace.cmd.getResult() == OK) {
} else if (replace.cmd != null && replace.cmd.getResult() == OK) {
try {
if (replace.insertPatchSet().checkedGet() != null) {
replace.inputCommand.setResult(OK);