From 4acb169bff44d3a792fbab33dd6afbd1dc3bc932 Mon Sep 17 00:00:00 2001 From: Botond Baranyi <botond.baranyi@ericsson.com> Date: Wed, 17 Jun 2020 17:11:39 +0200 Subject: [PATCH] OOP: fixed null reference as initial value for class variable (bug 563718) Change-Id: Ice786f009708e01f7944c020b553fa63ff977ac5 Signed-off-by: Botond Baranyi <botond.baranyi@ericsson.com> --- core/OOP.hh | 3 +++ regression_test/oop/oop.ttcn | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/core/OOP.hh b/core/OOP.hh index 5c2157652..376cd2b79 100644 --- a/core/OOP.hh +++ b/core/OOP.hh @@ -91,6 +91,9 @@ public: TTCN_error("Invalid dynamic type of initial value."); } } + else { + ptr = NULL; + } } void clean_up() { diff --git a/regression_test/oop/oop.ttcn b/regression_test/oop/oop.ttcn index 6c2a16741..59d02d1d2 100644 --- a/regression_test/oop/oop.ttcn +++ b/regression_test/oop/oop.ttcn @@ -385,6 +385,10 @@ testcase tc_references() runs on CT { if (ispresent(v_null)) { setverdict(fail, "#17"); } + var BaseClass v_base2 := v_null; + if (v_base2 != null) { + setverdict(fail, "#18"); + } setverdict(pass); } -- GitLab