OSDN Git Service

fix.
authorvisor <visor@users.sourceforge.jp>
Sat, 12 Dec 2015 13:59:48 +0000 (22:59 +0900)
committervisor <visor@users.sourceforge.jp>
Sat, 12 Dec 2015 13:59:48 +0000 (22:59 +0900)
wiki/wikiline.cc

index 9209445..c6a5031 100644 (file)
@@ -187,8 +187,13 @@ bool  wl_nth (WikiMotorObjVecVec* args, WikiMotorObjVec& out, WikiFormat* wiki)
     idx = strtol ((*args)[1]->textOut (wiki));
     e = wiki->getVar (var);
     if (e ()) {
-       e = e ()->vectorGet (idx);
-       val = fixUTF8 (to_string (e ()));
+       MNode*  a = e ();
+       while (idx > 0 && a && a->isCons ()) {
+           idx --;
+           nextNode (a);
+       }
+       if (a && a->isCons ())
+           val = fixUTF8 (to_string (a->car ()));
        return outamp_opt (o, opt, val);
     }
     return true;