From c4a32600ccd6706f53e821e71d781914a62ed7f0 Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Tue, 6 Sep 2016 13:53:37 -0500 Subject: [PATCH] Trick View: Can't set variables with -- units #301 Test before trying to convert NULL char * to string. --- .../sim_services/VariableServer/var_server_ext.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/trick_source/sim_services/VariableServer/var_server_ext.cpp b/trick_source/sim_services/VariableServer/var_server_ext.cpp index d746fbea..5220a7d6 100644 --- a/trick_source/sim_services/VariableServer/var_server_ext.cpp +++ b/trick_source/sim_services/VariableServer/var_server_ext.cpp @@ -525,8 +525,11 @@ int var_set_base( const char * var , T value , const char * units ) { V_DATA v_data ; v_tree.v_data = &v_data ; var_set_value( v_data , value) ; - //ref->units = (char *)units ; - ref->units = (char *)(map_trick_units_to_udunits(units).c_str()) ; + if ( units != NULL ) { + ref->units = (char *)(map_trick_units_to_udunits(units).c_str()) ; + } else { + ref->units = (char *)units ; + } ref_assignment(ref , &v_tree) ; free(ref) ; } else {