From 73d688c3134403511d9616fd875b78410ed5d0ee Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Tue, 12 Jul 2016 20:59:50 +0100 Subject: [PATCH] Fix for br1003 - prevent segfault when delays are used outside a module. (cherry picked from commit b8f9ed27c5f91496693260563adae142eaa3abc5) --- pform.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pform.cc b/pform.cc index 059a9d32e..5a8299468 100644 --- a/pform.cc +++ b/pform.cc @@ -1066,7 +1066,10 @@ void pform_set_timeunit(const char*txt, bool in_module, bool only_check) int pform_get_timeunit() { - return pform_cur_module.front()->time_unit; + if (pform_cur_module.front()) + return pform_cur_module.front()->time_unit; + else + return pform_time_unit; } void pform_set_timeprecision(const char*txt, bool in_module, bool only_check)