aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/interface
diff options
context:
space:
mode:
authorAlexander Arlt <alexander.arlt@arlt-labs.com>2018-02-14 04:40:16 +0800
committerAlexander Arlt <alexander.arlt@arlt-labs.com>2018-02-17 01:44:46 +0800
commit1d4547ab037db2f21fcb31219ae28a1d295ab270 (patch)
tree59d3cb61d7b4e470960eb87aa946fb6e24062b3c /libsolidity/interface
parent3f7e82d00ba6b0a9c1e7644b8613aa2126498893 (diff)
downloaddexon-solidity-1d4547ab037db2f21fcb31219ae28a1d295ab270.tar.gz
dexon-solidity-1d4547ab037db2f21fcb31219ae28a1d295ab270.tar.zst
dexon-solidity-1d4547ab037db2f21fcb31219ae28a1d295ab270.zip
Minor improvement: check sources
- returns error, if "sources" is an array, an empty object or not defined - Added new test-cases in test/libsolidity/StandardCompiler.cpp
Diffstat (limited to 'libsolidity/interface')
-rw-r--r--libsolidity/interface/StandardCompiler.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp
index 04f5bd25..84dedfb8 100644
--- a/libsolidity/interface/StandardCompiler.cpp
+++ b/libsolidity/interface/StandardCompiler.cpp
@@ -236,7 +236,11 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
return formatFatalError("JSONError", "Only \"Solidity\" is supported as a language.");
Json::Value const& sources = _input["sources"];
- if (!sources)
+
+ if (!sources.isObject() && !sources.isNull())
+ return formatFatalError("JSONError", "\"sources\" is not a JSON object.");
+
+ if (sources.empty())
return formatFatalError("JSONError", "No input sources specified.");
Json::Value errors = Json::arrayValue;