From 41ed27574cf871f48d4c4ddfed5285b9853b41d3 Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Fri, 3 Feb 2017 09:07:10 -0800 Subject: Fix potential NPE if we try to evaluate isMissingIOWrapper() inside IO(). (#479) --- chiselFrontend/src/main/scala/chisel3/core/Binding.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'chiselFrontend/src/main') diff --git a/chiselFrontend/src/main/scala/chisel3/core/Binding.scala b/chiselFrontend/src/main/scala/chisel3/core/Binding.scala index 71c441a7..a857ae85 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Binding.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Binding.scala @@ -155,7 +155,9 @@ object Binding { // we know the wrapper is missing, whether or not the element is a member of io. // But if it's not an io element, we want to issue the complementary "unbound" error. // Revisit this when we collect error messages instead of throwing exceptions. - x.io.flatten.contains(element) + // The null test below is due to the fact that we may be evaluating the arguments + // of the IO() wrapper itself. + (x.io != null) && x.io.flatten.contains(element) } } } -- cgit v1.2.3