{"record":{"id":"fa127ae88d4c0f86","repo":"MuntashirAkon/AppManager","slug":"unexpected-char-c","errorCode":null,"errorMessage":"Unexpected char '\" + c + \"'.","messagePattern":"Unexpected char '\" \\+ c \\+ \"'\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/svg/ParserHelper.java","lineNumber":344,"sourceCode":"                            }\n                        }\n                }\n            default:\n        }\n\n        if (!expPos) {\n            exp = -exp;\n        }\n        exp += expAdj;\n        if (!mantPos) {\n            mant = -mant;\n        }\n\n        return buildFloat(mant, exp);\n    }\n\n    private void reportUnexpectedCharacterError(char c) {\n        throw new RuntimeException(\"Unexpected char '\" + c + \"'.\");\n    }\n\n    /**\n     * Computes a float from mantissa and exponent.\n     */\n    public static float buildFloat(int mant, int exp) {\n        if (exp < -125 || mant == 0) {\n            return 0.0f;\n        }\n\n        if (exp >= 128) {\n            return (mant > 0)\n                    ? Float.POSITIVE_INFINITY\n                    : Float.NEGATIVE_INFINITY;\n        }\n\n        if (exp == 0) {\n            return mant;","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/svg/ParserHelper.java#L326-L362","documentation":"ParserHelper (SVG path/number parser) throws RuntimeException(\"Unexpected char '<c>'.\") when parseFloat encounters a character that cannot start or continue a numeric value. It is an unchecked parsing failure for malformed SVG numeric data.","triggerScenarios":"Parsing SVG path data or numeric attributes where an unexpected character appears where a number (or separator) is expected — e.g. 'parseFloat(\"1.2.3\")', letters inside coordinates, or a malformed command sequence.","commonSituations":"Hand-edited or generated SVG with malformed path data (missing separators, doubled dots, stray commas/letters); SVGs exported by buggy tools; user-uploaded icons; locale-corrupted numbers with decimal commas ('1,5' in some contexts).","solutions":["Validate/normalize SVG path data before parsing (regex for numeric tokens, fix separators).","Catch RuntimeException around the SVG parse and fall back to skipping the malformed element.","Sanitize numbers: convert locale decimal commas to dots and remove duplicate dots before feeding the parser.","Regenerate the SVG from a known-good editor/exporter."],"exampleFix":"// before\nfloat v = parserHelper.parseFloat(); // RuntimeException on '2.3.4'\n// after\ntry {\n    float v = parserHelper.parseFloat();\n} catch (RuntimeException e) {\n    Log.w(TAG, \"Skipping malformed SVG number\", e);\n}","handlingStrategy":"try-catch","validationCode":"if (!pathData.matches(\"[MmZzLlHhVvCcSsQqTtAa0-9eE+\\\\-., \\\\t\\\\r\\\\n]*\")) throw new IllegalArgumentException(\"Malformed SVG path data\");","typeGuard":null,"tryCatchPattern":"try { value = parserHelper.parseFloat(); } catch (RuntimeException e) { Log.w(TAG, \"Unexpected char in SVG data\", e); value = 0f; }","preventionTips":["Validate SVG path syntax before parsing","Normalize decimal separators and stray dots","Fuzz-test the SVG parser with malformed inputs"],"tags":["svg","parsing","malformed-input"],"backgroundTag":"invalid-argument-format","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}