diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2015-05-12 22:42:26 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2015-05-12 22:42:26 +0900 |
| commit | 62826d691deee1812fc2a43b9495b83a367dcde2 (patch) | |
| tree | 5ce034729d62d8d17b6189b50bc32a83d5e6ad99 | |
| parent | 5723f4211a06bc320efdca844b399a2a5b5162ca (diff) | |
ftp: Fix accessing first element in empty segments vector
| -rw-r--r-- | src/FtpNegotiationCommand.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/FtpNegotiationCommand.cc b/src/FtpNegotiationCommand.cc index 49508a94..1655a775 100644 --- a/src/FtpNegotiationCommand.cc +++ b/src/FtpNegotiationCommand.cc @@ -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) { |
