diff options
author | Yoichi Hirai <i@yoichihirai.com> | 2016-10-14 02:17:13 +0800 |
---|---|---|
committer | Yoichi Hirai <i@yoichihirai.com> | 2016-10-14 02:17:13 +0800 |
commit | 8e11bac8dee78f0133dd1a06644dc8b55123c58c (patch) | |
tree | 851f87c6a8486a684492c2e03262b593b6fc53d5 /libsolidity | |
parent | 5e75cae28abd79c499aa8ba4b567efdf801ed735 (diff) | |
download | dexon-solidity-8e11bac8dee78f0133dd1a06644dc8b55123c58c.tar.gz dexon-solidity-8e11bac8dee78f0133dd1a06644dc8b55123c58c.tar.zst dexon-solidity-8e11bac8dee78f0133dd1a06644dc8b55123c58c.zip |
Check if a fixedBytes fits an integer type
before looking up the size of the integer type.
Fixes #1150.
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/ast/Types.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 6d1af534..edb0fbe4 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -574,7 +574,11 @@ bool RationalNumberType::isImplicitlyConvertibleTo(Type const& _convertTo) const { FixedBytesType const& fixedBytes = dynamic_cast<FixedBytesType const&>(_convertTo); if (!isFractional()) - return fixedBytes.numBytes() * 8 >= integerType()->numBits(); + { + if (integerType()) + return fixedBytes.numBytes() * 8 >= integerType()->numBits(); + return false; + } else return false; } |