From 9404bfb2ccb8ba69862bf07f73f465d142e18e6c Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Tue, 19 Dec 2017 11:13:27 -0500 Subject: [PATCH] don't attempt to link contract if it's not in the code --- lib/contracts/deploy.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/contracts/deploy.js b/lib/contracts/deploy.js index 1123117eb..d80a987c7 100644 --- a/lib/contracts/deploy.js +++ b/lib/contracts/deploy.js @@ -115,11 +115,14 @@ class Deploy { deployedAddress = deployedAddress.substr(2); } let linkReference = '__' + filename + ":" + contractObj.className; + if (contractCode.indexOf(linkReference) < 0) { + continue; + } if (linkReference.length > 40) { return callback(new Error(linkReference + " is too long, try reducing the path of the contract (" + filename + ") and/or its name " + contractObj.className)); } let toReplace = linkReference + "_".repeat(40 - linkReference.length); - if (contractCode.indexOf(linkReference) >= 0 && deployedAddress === undefined) { + if (deployedAddress === undefined) { let libraryName = contractObj.className; return callback(new Error(contract.className + " needs " + libraryName + " but an address was not found, did you deploy it or configured an address?")); }