From 93c488ce736f9f26edb556a4e112b188bdf4465e Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Tue, 2 Dec 2014 11:03:34 +0100 Subject: [PATCH] Handle absence of Natspec doc and add option to solc --- libsolidity/CompilerStack.cpp | 8 ++++++-- solc/main.cpp | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libsolidity/CompilerStack.cpp b/libsolidity/CompilerStack.cpp index 77a019b5f..2b2991584 100644 --- a/libsolidity/CompilerStack.cpp +++ b/libsolidity/CompilerStack.cpp @@ -140,8 +140,12 @@ string const& CompilerStack::getDocumentation() for (FunctionDefinition const* f: exportedFunctions) { Json::Value user; - user["user"] = Json::Value(*f->getDocumentation()); - methods[f->getName()] = user; + auto strPtr = f->getDocumentation(); + if (strPtr) + { + user["user"] = Json::Value(*strPtr); + methods[f->getName()] = user; + } } doc["methods"] = methods; m_documentation = writer.write(doc); diff --git a/solc/main.cpp b/solc/main.cpp index a7216e594..6ca130a79 100644 --- a/solc/main.cpp +++ b/solc/main.cpp @@ -136,6 +136,7 @@ int main(int argc, char** argv) cout << eth::disassemble(compiler.getBytecode()) << endl; cout << "Binary: " << toHex(compiler.getBytecode()) << endl; cout << "Interface specification: " << compiler.getInterface() << endl; + cout << "Natspec documentation: " << compiler.getDocumentation() << endl; return 0; }