From 9e0e3ab62b2b60c562e5bc60a4a6e26d4699b288 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Mon, 14 Jan 2013 15:02:02 -0500 Subject: [PATCH] fix bug in TOC construction in cre.cpp first toc entry should start with index 1 instead of 0 --- cre.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cre.cpp b/cre.cpp index aaa6a8050..47998a13b 100644 --- a/cre.cpp +++ b/cre.cpp @@ -209,7 +209,7 @@ static int walkTableOfContent(lua_State *L, LVTocItem *toc, int *count) { int i = 0, nr_child = toc->getChildCount(); - for(i = 0; i < nr_child; i++) { + for (i = 0; i < nr_child; i++) { toc_tmp = toc->getChild(i); lua_pushnumber(L, (*count)++); @@ -266,7 +266,7 @@ static int getTableOfContent(lua_State *L) { CreDocument *doc = (CreDocument*) luaL_checkudata(L, 1, "credocument"); LVTocItem * toc = doc->text_view->getToc(); - int count = 0; + int count = 1; lua_newtable(L); walkTableOfContent(L, toc, &count);