{"record":{"id":"b0ac064379b411b5","repo":"Tencent/QMUI_Android","slug":"mcompiler-null","errorCode":null,"errorMessage":"mCompiler == null","messagePattern":"mCompiler == null","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"qmui/src/main/java/com/qmuiteam/qmui/qqface/QMUIQQFaceView.java","lineNumber":532,"sourceCode":"     * @return\n     */\n    public Rect getMoreHitRect() {\n        return mMoreHitRect;\n    }\n\n    public void setText(CharSequence charSequence) {\n        setText(charSequence, true);\n    }\n\n    private void setText(CharSequence charSequence, boolean compareOldText) {\n        if (compareOldText && QMUILangHelper.objectEquals(charSequence, mOriginText)) {\n            return;\n        }\n\n        mOriginText = charSequence;\n        setContentDescription(charSequence);\n        if (mOpenQQFace && mCompiler == null) {\n            throw new RuntimeException(\"mCompiler == null\");\n        }\n\n        mSpanInfos.clear();\n        if (QMUILangHelper.isNullOrEmpty(mOriginText)) {\n            mElementList = null;\n            requestLayout();\n            invalidate();\n            return;\n        }\n\n        if (mOpenQQFace && mCompiler != null) {\n            mElementList = mCompiler.compile(mOriginText);\n            List<QMUIQQFaceCompiler.Element> elements = mElementList.getElements();\n            if (elements != null) {\n                for (int i = 0; i < elements.size(); i++) {\n                    QMUIQQFaceCompiler.Element element = elements.get(i);\n                    if (element.getType() == QMUIQQFaceCompiler.ElementType.SPAN) {\n                        mSpanInfos.put(element, new SpanInfo(element.getTouchableSpan()));","sourceCodeStart":514,"sourceCodeEnd":550,"githubUrl":"https://github.com/Tencent/QMUI_Android/blob/026e7d486677d6593a96689cd590ec3561176717/qmui/src/main/java/com/qmuiteam/qmui/qqface/QMUIQQFaceView.java#L514-L550","documentation":"QMUIQQFaceView.setText() throws a RuntimeException when QQ face parsing is enabled (mOpenQQFace == true) but no compiler has been installed via setCompiler(). Without the compiler the view cannot parse face codes, so it fails fast at setText time rather than rendering raw codes.","triggerScenarios":"Enabling openQQFace (XML attribute or setter) on a QMUIQQFaceView and then calling setText() without ever calling setCompiler(new QMUIQQFaceCompiler(...)).","commonSituations":"Adding a QMUIQQFaceView in XML with app:qmui_open_qq_face=\"true\" but forgetting the compiler setup; view created before the compiler-dependent module init; constructors calling setText before setCompiler.","solutions":["Call setCompiler(new QMUIQQFaceCompiler(context)) before the first setText (typically right after inflating/constructing the view).","If faces are not needed, disable them (qmui_open_qq_face=false / setter) instead of leaving the compiler unset.","Move setCompiler earlier in initialization so it precedes any programmatic or constructor-driven setText."],"exampleFix":"// before\nQMUIQQFaceView view = findViewById(R.id.qq_face_view); // openQQFace=true\nview.setText(\"hello [QQ emoji] \"); // throws\n\n// after\nQMUIQQFaceView view = findViewById(R.id.qq_face_view);\nview.setCompiler(new QMUIQQFaceCompiler(context));\nview.setText(\"hello [QQ emoji] \");","handlingStrategy":"validation","validationCode":"if (view.isOpenQQFace() && view.getCompiler() == null) {\n    view.setCompiler(new QMUIQQFaceCompiler(context));\n}\nview.setText(text);","typeGuard":"boolean isQQFaceViewReady(QMUIQQFaceView v) {\n    return !v.isOpenQQFace() || v.getCompiler() != null;\n}","tryCatchPattern":"try {\n    view.setText(text);\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"mCompiler == null\")) {\n        view.setCompiler(new QMUIQQFaceCompiler(context));\n        view.setText(text);\n    } else throw e;\n}","preventionTips":["Call setCompiler immediately after creating/inflating QMUIQQFaceView","Disable qmui_open_qq_face if face parsing is unused","Centralize QMUIQQFaceView construction in a factory that always installs the compiler"],"tags":["android","qmui","qqface","missing-dependency","uninitialized-state"],"backgroundTag":"missing-dependency","analyzedSha":"026e7d486677d6593a96689cd590ec3561176717","analyzedAt":"2026-09-06T13:32:24.816Z","contentChangedAt":"2026-09-06T13:32:24.816Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}