From 350b55b6ba9276af6a1a3fb29ac3a8c6688a31ff Mon Sep 17 00:00:00 2001 From: hoxovic <9694402+hoxovic@users.noreply.github.com> Date: Fri, 10 Jan 2020 13:25:02 +0100 Subject: [PATCH] Fix emit_go error (#294) Add check if member is primitive type before calling lcm_find_struct() --- CMakeLists.txt | 5 +---- lcmgen/emit_go.c | 7 +++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9922e9c24..6d3a4c26b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,10 +77,7 @@ endif() lcm_option( LCM_ENABLE_GO "Build Go utilities, bindings is source distributed" - - # Disable until #294 is resolved - FALSE Go) - # GO_FOUND Go) + GO_FOUND Go) option(LCM_ENABLE_TESTS "Build unit tests" ON) if(LCM_ENABLE_TESTS) diff --git a/lcmgen/emit_go.c b/lcmgen/emit_go.c index 2c5495560..c4eed0d27 100644 --- a/lcmgen/emit_go.c +++ b/lcmgen/emit_go.c @@ -567,8 +567,11 @@ static unsigned int emit_go_array_loops(FILE *f, lcmgen_t *lcm, lcm_struct_t *ls map_builtintype_name(lcm_find_member(ls, dim->size)->type->lctypename); if (slice_emit){ - lcm_struct_t *ls_lm = lcm_find_struct(lcm, lm); - uint64_t lm_fingerprint = lcm_get_fingerprint(lcm, ls_lm); + uint64_t lm_fingerprint = fingerprint; + if (!lcm_is_primitive_type(lm->type->lctypename)) { + lcm_struct_t *ls_lm = lcm_find_struct(lcm, lm); + lm_fingerprint = lcm_get_fingerprint(lcm, ls_lm); + } emit_go_slice_make(f, n + 1, ls->structname->package, lm, n, slicestr->str, size, lm_fingerprint); }