Skip to content

Commit 8a4c465

Browse files
skoehler47emweb
authored andcommitted
Fixed an access violation that crashes the whole server whenever
the 'ApplicationCreator function' returns a nullptr
1 parent 632665d commit 8a4c465

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/web/WebSession.C

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,9 +680,15 @@ bool WebSession::start(WebResponse *response)
680680
{
681681
try {
682682
app_ = controller_->doCreateApplication(this).release();
683-
if (!app_->internalPathValid_)
684-
if (response->responseType() == WebResponse::ResponseType::Page)
685-
response->setStatus(404);
683+
if (app_) {
684+
if (!app_->internalPathValid_) {
685+
if (response->responseType() == WebResponse::ResponseType::Page) {
686+
response->setStatus(404);
687+
}
688+
}
689+
} else {
690+
throw WException("WebSession::start: ApplicationCreator returned a nullptr");
691+
}
686692
} catch (std::exception& e) {
687693
app_ = nullptr;
688694

0 commit comments

Comments
 (0)