From 21823652b9c8a7fece9a00c0b8659c8a19b1c00f Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 27 Jul 2022 22:30:48 +0800 Subject: improve has_tool --- xmake/core/package/package.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 94dd88b61..11db68e0d 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -993,9 +993,11 @@ end -- end function _instance:has_tool(toolkind, ...) local _, toolname = self:tool(toolkind) - for _, v in ipairs(table.join(...)) do - if v and toolname:find("^" .. v:gsub("%-", "%%-") .. "$") then - return true + if toolname then + for _, v in ipairs(table.join(...)) do + if v and toolname:find("^" .. v:gsub("%-", "%%-") .. "$") then + return true + end end end end -- cgit v1.3.1