Skip to content

Commit ddc4cf0

Browse files
committed
Fixed a possible access violation in WApplication::UpdateLock
1 parent d53b506 commit ddc4cf0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Wt/WApplication.C

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1470,6 +1470,14 @@ WApplication::UpdateLock::UpdateLock(WApplication *app)
14701470
#ifndef WT_THREADED
14711471
return;
14721472
#else
1473+
1474+
// check if 'app' is a nullptr to prevent an access violation
1475+
// in the following code
1476+
if (!app) {
1477+
ok_ = false;
1478+
return;
1479+
}
1480+
14731481
/*
14741482
* If we are already handling this application, then we already have
14751483
* exclusive access, unless we are not having the lock (e.g. from a
@@ -1498,7 +1506,7 @@ WApplication::UpdateLock::UpdateLock(WApplication *app)
14981506
WebSession::Handler *handler = WebSession::Handler::instance();
14991507

15001508
createdHandler_ = false;
1501-
if (handler && handler->haveLock() && handler->session() == app->session_)
1509+
if (app && handler && handler->haveLock() && handler->session() == app->session_)
15021510
return;
15031511

15041512
new WebSession::Handler(app->session_, WebSession::Handler::LockOption::TakeLock);

0 commit comments

Comments
 (0)