diff --git a/layout/base/nsBidiPresUtils.cpp b/layout/base/nsBidiPresUtils.cpp index ad085edbb12f..b1215972c243 100644 --- a/layout/base/nsBidiPresUtils.cpp +++ b/layout/base/nsBidiPresUtils.cpp @@ -2363,6 +2363,12 @@ void nsBidiPresUtils::ProcessSimpleRun(const char16_t* aText, size_t aLength, nsBidiPositionResolve* aPosResolve, int32_t aPosResolveCount, nscoord* aWidth) { + if (!aLength) { + if (aWidth) { + *aWidth = 0; + } + return; + } // Get bidi class from the first (or only) character. uint32_t ch = aText[0]; if (aLength > 1 && NS_IS_HIGH_SURROGATE(ch) &&