Fix a bug in printing plain strings
The bug was that I was not taking into account that I was receiving a
char** from the vector.
diff --git a/src/bc/program.c b/src/bc/program.c
index 530ab74..6278eee 100644
--- a/src/bc/program.c
+++ b/src/bc/program.c
@@ -1860,7 +1860,7 @@
case BC_INST_STR:
{
- const char *string;
+ const char **string;
idx = bc_program_index(code, &ip->idx);
@@ -1868,7 +1868,9 @@
string = bc_vec_item(&p->strings, idx);
- pchars = fprintf(stdout, "%s", string);
+ if (!string) return BC_STATUS_EXEC_INVALID_STRING;
+
+ pchars = fprintf(stdout, "%s", *string);
status = pchars > 0 ? BC_STATUS_SUCCESS :
BC_STATUS_EXEC_PRINT_ERR;