From fa0d9c8d55962d3cfdc1eb3c4a6154fae3b29b86 Mon Sep 17 00:00:00 2001 From: tkzcfc Date: Mon, 12 Dec 2022 20:56:48 +0800 Subject: [PATCH] Fix download task creation failure Program crash (#984) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Support return type'ResourceData' * Revert "Support return type'ResourceData'" This reverts commit dd38d063509a2c3dd460a935310b2c2522de50f9. * Support return type'ResourceData' * Support binary files * Support Lua to call cc.utils: capturenode * Support Lua to call cc.utils: capturenode * export: sp.SkeletonAnimation:findBone sp.SkeletonAnimation:getBoundingBox * export 'setAttachment' function to lua * Committing genbindings changes * search path adding repeated judgment * add macro definition AX_NO_DUP_SEARCH_PATH * add macro definition AX_NO_DUP_SEARCH_PATH * Update core/platform/CCFileUtils.cpp * Fix downloader crash in the lua coroutine * fix download task creation failure Program crash Co-authored-by: tkzcfc Co-authored-by: 一线灵|Deal Co-authored-by: HYGK-PC\Administrator --- .../lua-bindings/manual/network/lua_downloader.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/extensions/scripting/lua-bindings/manual/network/lua_downloader.cpp b/extensions/scripting/lua-bindings/manual/network/lua_downloader.cpp index c007d42a62..e54f37027c 100644 --- a/extensions/scripting/lua-bindings/manual/network/lua_downloader.cpp +++ b/extensions/scripting/lua-bindings/manual/network/lua_downloader.cpp @@ -166,7 +166,10 @@ static int lua_downloader_createDownloadDataTask(lua_State* L) identifier = lua_tostring(L, 3); auto tsk = d->createDownloadDataTask(url, identifier); - pushTaskTable(L, *tsk); + if (tsk) + pushTaskTable(L, *tsk); + else + lua_pushnil(L); return 1; } @@ -204,7 +207,10 @@ static int lua_downloader_createDownloadFileTask(lua_State* L) auto tsk = d->createDownloadFileTask(url, storagePath, identifier, md5checksum, background, cacertPath); - pushTaskTable(L, *tsk); + if (tsk) + pushTaskTable(L, *tsk); + else + lua_pushnil(L); return 1; } static int lua_downloader_setOnFileTaskSuccess(lua_State* L)