Fix crash if tpt.installScriptManager fails
In which case the request completion handler code neglected to reset the unique_ptr holding the request.
This commit is contained in:
parent
79f45eb096
commit
ef308c1e48
@ -46,6 +46,7 @@ void LuaMisc::Tick(lua_State *L)
|
|||||||
auto *lsi = GetLSI();
|
auto *lsi = GetLSI();
|
||||||
if (lsi->scriptManagerDownload && lsi->scriptManagerDownload->CheckDone())
|
if (lsi->scriptManagerDownload && lsi->scriptManagerDownload->CheckDone())
|
||||||
{
|
{
|
||||||
|
auto scriptManagerDownload = std::move(lsi->scriptManagerDownload);
|
||||||
struct Status
|
struct Status
|
||||||
{
|
{
|
||||||
struct Ok
|
struct Ok
|
||||||
@ -82,8 +83,8 @@ void LuaMisc::Tick(lua_State *L)
|
|||||||
};
|
};
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto ret = lsi->scriptManagerDownload->StatusCode();
|
auto ret = scriptManagerDownload->StatusCode();
|
||||||
auto scriptData = lsi->scriptManagerDownload->Finish().second;
|
auto scriptData = scriptManagerDownload->Finish().second;
|
||||||
if (!scriptData.size())
|
if (!scriptData.size())
|
||||||
{
|
{
|
||||||
complete({ Status::GetFailed{ "Server did not return data" } });
|
complete({ Status::GetFailed{ "Server did not return data" } });
|
||||||
@ -111,7 +112,6 @@ void LuaMisc::Tick(lua_State *L)
|
|||||||
{
|
{
|
||||||
complete({ Status::GetFailed{ ByteString(ex.what()).FromUtf8() } });
|
complete({ Status::GetFailed{ ByteString(ex.what()).FromUtf8() } });
|
||||||
}
|
}
|
||||||
lsi->scriptManagerDownload.reset();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user