Skip to content

Commit

Permalink
Fix empty string issue on http download
Browse files Browse the repository at this point in the history
  • Loading branch information
navv1234 committed Jan 10, 2019
1 parent 02d827c commit f991d82
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions engine/interfaces/sc_http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ class curl_handle_t
std::transform( key.begin(), key.end(), key.begin(), tolower );

// Prune whitespaces from values
while ( value.back() == ' ' || value.back() == '\n' ||
value.back() == '\t' || value.back() == '\r' )
while ( !value.empty() && ( value.back() == ' ' || value.back() == '\n' ||
value.back() == '\t' || value.back() == '\r' ) )
{
value.pop_back();
}

while ( value.front() == ' ' )
while ( !value.empty() && ( value.front() == ' ' || value.front() == '\t' ) )
{
value.erase( value.begin() );
}
Expand Down

0 comments on commit f991d82

Please sign in to comment.