From 2aa132d3454d4597822b976c402875fbd4dd2155 Mon Sep 17 00:00:00 2001 From: Zeex Date: Sun, 6 Apr 2014 00:43:51 +0700 Subject: [PATCH] Fix crash when compiling with -r This fixes a crash in sc_attachdocumentation() where get_docstring() returned an invalid string pointer because get_string() compared the string index with list->size instead of list->length (the actual length of the list). Fixes #19. --- source/compiler/sclist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/compiler/sclist.c b/source/compiler/sclist.c index 71ff2a5..d52f9f1 100644 --- a/source/compiler/sclist.c +++ b/source/compiler/sclist.c @@ -171,7 +171,7 @@ static stringlist *insert_string(stringlist *list,char *string) static char *get_string(stringlist *list,int index) { assert(list!=NULL); - if (index>=0 && indexsize) + if (index>=0 && indexlength) return list->strings[index]; return NULL; }