ftp: Fix accessing first element in empty segments vector

pull/384/head
Tatsuhiro Tsujikawa 2015-05-12 22:42:26 +09:00
parent 5723f4211a
commit 62826d691d
1 changed files with 3 additions and 1 deletions

View File

@ -106,7 +106,9 @@ FtpNegotiationCommand::FtpNegotiationCommand
FtpNegotiationCommand::~FtpNegotiationCommand() {}
bool FtpNegotiationCommand::executeInternal() {
while(processSequence(getSegments().front()));
auto segment = getSegments().empty() ?
std::shared_ptr<Segment>() : getSegments().front();
while(processSequence(segment));
if(sequence_ == SEQ_RETRY) {
return prepareForRetry(0);
} else if(sequence_ == SEQ_NEGOTIATION_COMPLETED) {