Skip to content

Commit c4a3260

Browse files
committed
Trick View: Can't set variables with -- units #301
Test before trying to convert NULL char * to string.
1 parent b32015a commit c4a3260

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

trick_source/sim_services/VariableServer/var_server_ext.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,11 @@ int var_set_base( const char * var , T value , const char * units ) {
525525
V_DATA v_data ;
526526
v_tree.v_data = &v_data ;
527527
var_set_value( v_data , value) ;
528-
//ref->units = (char *)units ;
529-
ref->units = (char *)(map_trick_units_to_udunits(units).c_str()) ;
528+
if ( units != NULL ) {
529+
ref->units = (char *)(map_trick_units_to_udunits(units).c_str()) ;
530+
} else {
531+
ref->units = (char *)units ;
532+
}
530533
ref_assignment(ref , &v_tree) ;
531534
free(ref) ;
532535
} else {

0 commit comments

Comments
 (0)