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
This commit is contained in:
Alexander Arlt
2018-02-16 18:44:46 +01:00
parent 3f7e82d00b
commit 1d4547ab03
3 changed files with 42 additions and 2 deletions
+5 -1
View File
@@ -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;