From 18d6325eff945616d4c5a6db80a319aa3bb1ba57 Mon Sep 17 00:00:00 2001
From: Nora Abi Akar <nora.abiakar@gmail.com>
Date: Wed, 23 Oct 2019 16:29:17 +0200
Subject: [PATCH] fix segmentation fault (#895)

* Fix modcc segmentation fault caused by improper check for the presence of a symbol, triggered when a symbol defined in a RANGE is absent from the ASSIGNED and PARAMETER blocks.
---
 modcc/module.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modcc/module.cpp b/modcc/module.cpp
index df34279f..7a4aaaee 100644
--- a/modcc/module.cpp
+++ b/modcc/module.cpp
@@ -683,7 +683,7 @@ void Module::add_variables_to_symbols() {
 
     // then GLOBAL variables
     for(auto const& var : neuron_block_.globals) {
-        if(!symbols_[var.spelling]) {
+        if(!symbols_.count(var.spelling)) {
             error( yellow(var.spelling) +
                    " is declared as GLOBAL, but has not been declared in the" +
                    " ASSIGNED block",
@@ -703,7 +703,7 @@ void Module::add_variables_to_symbols() {
 
     // then RANGE variables
     for(auto const& var : neuron_block_.ranges) {
-        if(!symbols_[var.spelling]) {
+        if(!symbols_.count(var.spelling)) {
             error( yellow(var.spelling) +
                    " is declared as RANGE, but has not been declared in the" +
                    " ASSIGNED or PARAMETER block",
-- 
GitLab