OSDN Git Service

Correct string out of bounds exception when editing LaTeX formula.
authorRandy Baumgarte <randy@fbn.cx>
Wed, 21 Dec 2011 15:20:19 +0000 (10:20 -0500)
committerRandy Baumgarte <randy@fbn.cx>
Wed, 21 Dec 2011 15:20:19 +0000 (10:20 -0500)
src/cx/fbn/nevernote/xml/HtmlTagModifier.java

index 9a4eeeb..6b327cb 100644 (file)
@@ -75,12 +75,13 @@ public class HtmlTagModifier {
        }\r
        \r
        public void replaceValue(int position, String attribute, String newValue) {\r
        }\r
        \r
        public void replaceValue(int position, String attribute, String newValue) {\r
+\r
                int endPosition = html.indexOf(">", position);\r
                if (endPosition < 0)\r
                        return;\r
                \r
                int attributeStart = html.indexOf(attribute, position);\r
                int endPosition = html.indexOf(">", position);\r
                if (endPosition < 0)\r
                        return;\r
                \r
                int attributeStart = html.indexOf(attribute, position);\r
-               if (attributeStart < 0)\r
+               if (attributeStart < 0 || attributeStart > endPosition)\r
                        return;\r
                \r
                int attributeEnd = html.indexOf(" ", attributeStart);\r
                        return;\r
                \r
                int attributeEnd = html.indexOf(" ", attributeStart);\r