Skip to content

Commit

Permalink
fix faulty substr ClientException catch
Browse files Browse the repository at this point in the history
  • Loading branch information
Tentanus committed May 16, 2024
1 parent 704e62a commit fad8044
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,13 @@ ClientState Client::handleConnection(
_exit(1);
_response.clear();
_file_manager.setResponse(e.what());
_state = _file_manager.openErrorPage(
_serversetting.getErrorDir().substr(1), e.getStatusCode());

const std::string errdir = _serversetting.getErrorDir();
if (errdir.empty())
_state = _file_manager.openErrorPage("", e.getStatusCode());
else
_state = _file_manager.openErrorPage(errdir.substr(1),
e.getStatusCode());
return (_state);
}
catch (ReturnException &e)
Expand Down

0 comments on commit fad8044

Please sign in to comment.