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 d52dcfeea0f4a9274d739ef3b0caabe29b37fe1d..108094bc621656d3bd41672a80495a5cfb8ada29 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