Skip to content

Commit 400a3a6

Browse files
committed
Init PrimitiveEntry p
1 parent e899c91 commit 400a3a6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Primitives/primitives.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,12 @@ void create_stack(std::vector<StackValue> *stack, T value, Ts... args) {
6060

6161
template <typename... Ts>
6262
void invoke_primitive(Module *m, const std::string &function_name, Ts... args) {
63-
Primitive primitive;
64-
m->warduino->interpreter->resolve_primitive(function_name.c_str(),
65-
&primitive);
63+
Primitive primitive = {};
64+
if (!m->warduino->interpreter->resolve_primitive(function_name.c_str(),
65+
&primitive)) {
66+
printf("Failed to resolve primitive %s\n", function_name.c_str());
67+
return;
68+
}
6669

6770
std::vector<StackValue> argStack;
6871
create_stack(&argStack, args...);
@@ -76,7 +79,7 @@ void invoke_primitive(Module *m, const std::string &function_name, Ts... args) {
7679
#define _install_primitive(prim_name) \
7780
/*dbg_info("installing primitive number: %d of %d with name: %s\n", \ \
7881
prim_index + 1, ALL_PRIMITIVES, #prim_name); \*/ \
79-
PrimitiveEntry p; \
82+
PrimitiveEntry p = {}; \
8083
p.name = #prim_name; \
8184
p.t = &(prim_name##_type); \
8285
p.f = &(prim_name); \

0 commit comments

Comments
 (0)