From f305cafe8cd39eb7ce04d8ae90d410c0c2686e41 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 6 Dec 2006 00:53:34 +0000 Subject: [PATCH] fixed a compiler bug with declaring natives having parameters with no arrays and returning strings --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40196 --- sourcepawn/compiler/sc1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index 0f678fa1..d5de9d8c 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -2269,7 +2269,7 @@ static int declloc(int fstatic) } while (matchtoken('[')); if (all_constant) { /* Change the last dimension to be based on chars instead if we have a string */ - if (tag == pc_tag_string && dim[numdim-1]) + if (tag == pc_tag_string && numdim && dim[numdim-1]) dim[numdim-1] = (dim[numdim-1] + sizeof(cell)-1) / sizeof(cell); /* Scrap the code generated */ ident = iARRAY; @@ -3736,7 +3736,7 @@ static void funcstub(int fnative) dim[numdim++]=(int)size; } /* while */ - if (tag == pc_tag_string && dim[numdim-1]) + if (tag == pc_tag_string && numdim && dim[numdim-1]) dim[numdim-1] = (size + sizeof(cell)-1) / sizeof(cell); tok=lex(&val,&str);