gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
substr should not be called with a negative length - so we prevent this with a MIN...
authorDoni Pracner <quinnuendo@gmail.com>
Fri, 25 Jul 2014 21:11:26 +0000 (23:11 +0200)
committerDoni Pracner <quinnuendo@gmail.com>
Fri, 25 Jul 2014 21:11:26 +0000 (23:11 +0200)
src/mjc2wsl.java

index d52dcfe..108094b 100644 (file)
@@ -694,7 +694,7 @@ public class mjc2wsl{
                                prl(createTopTwoEStack());
                                if (genInlinePrint){
                                        prl(createComment("print spacing and transformation",C_SPEC));
-                                       prl("PRINFLUSH(SUBSTR(\"          \", 0, MIN(10, tempa - 1)), @List_To_String(< tempb >));");
+                                       prl("PRINFLUSH(SUBSTR(\"          \", 0, MIN(10, MAX(0,tempa-1))), @List_To_String(< tempb >));");
                                } else
                                        prl("Print_MJ_CHAR(tempb,tempa);");
                                prl(createEndVar());
@@ -707,7 +707,7 @@ public class mjc2wsl{
                                prl(createTopTwoEStack());
                                if (genInlinePrint){
                                        prl(createComment("print spacing",C_SPEC));
-                                       prl("PRINFLUSH(SUBSTR(\"          \", 0, MIN(10, tempa - 1)), tempb);");
+                                       prl("PRINFLUSH(SUBSTR(\"          \", 0, MIN(10, MAX(0, tempa-1))), tempb);");
                                }
                                else
                                        prl("Print_MJ(tempb,tempa);");
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner