aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/ast
diff options
context:
space:
mode:
authorLeonardo Alt <leo@ethereum.org>2018-11-28 23:16:02 +0800
committerLeonardo Alt <leo@ethereum.org>2018-11-29 17:38:47 +0800
commit1d47919c0c77f23542f62f3e4cab83b264d06fa4 (patch)
treeed25309876b893cab0d2427a72868d8c8b9f5dce /libsolidity/ast
parentb4086ac87037813eb553e92839bbc40de6bbd9ac (diff)
downloaddexon-solidity-1d47919c0c77f23542f62f3e4cab83b264d06fa4.tar
dexon-solidity-1d47919c0c77f23542f62f3e4cab83b264d06fa4.tar.gz
dexon-solidity-1d47919c0c77f23542f62f3e4cab83b264d06fa4.tar.bz2
dexon-solidity-1d47919c0c77f23542f62f3e4cab83b264d06fa4.tar.lz
dexon-solidity-1d47919c0c77f23542f62f3e4cab83b264d06fa4.tar.xz
dexon-solidity-1d47919c0c77f23542f62f3e4cab83b264d06fa4.tar.zst
dexon-solidity-1d47919c0c77f23542f62f3e4cab83b264d06fa4.zip
Fix ICE when function type struct parameter has field of non-existent type
Diffstat (limited to 'libsolidity/ast')
-rw-r--r--libsolidity/ast/Types.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index 102e43e9..16e9cf89 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -2124,9 +2124,15 @@ bool StructType::canBeUsedExternally(bool _inLibrary) const
// We pass "false" to canBeUsedExternally (_inLibrary), because this struct will be
// passed by value and thus the encoding does not differ, but it will disallow
// mappings.
+ // Also return false if at least one struct member does not have a type.
+ // This might happen, for example, if the type of the member does not exist,
+ // which is reported as an error.
for (auto const& var: m_struct.members())
{
- solAssert(var->annotation().type, "");
+ // If the struct member does not have a type return false.
+ // A TypeError is expected in this case.
+ if (!var->annotation().type)
+ return false;
if (!var->annotation().type->canBeUsedExternally(false))
return false;
}