Skip to content

Commit 76d679c

Browse files
committed
[1.2>master] [MERGE #780] Globalization Assert
Merge pull request #780 from Cellule:globalization Relax assert in Globalization IsWellFormed. It is valid to have nullptr as a string as it will correctly throw a javascript Error that the Local is not well-formed.
2 parents bc451ac + a035d0f commit 76d679c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/Runtime/Base/WindowsGlobalizationAdapter.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,15 @@ namespace Js
349349
{
350350
boolean retVal;
351351
HRESULT hr;
352-
HSTRING hString;
352+
HSTRING hString = nullptr;
353353
HSTRING_HEADER hStringHdr;
354354
// OK for languageTag to get truncated as it would pass incomplete languageTag below which
355355
// will be rejected by globalization dll
356356
IfFailThrowHr(GetWindowsGlobalizationLibrary(scriptContext)->WindowsCreateStringReference(languageTag, static_cast<UINT32>(wcslen(languageTag)), &hStringHdr, &hString));
357-
AnalysisAssert(hString);
357+
if (hString == nullptr)
358+
{
359+
return 0;
360+
}
358361
IfFailThrowHr(this->languageStatics->IsWellFormed(hString, &retVal));
359362
return retVal;
360363
}

0 commit comments

Comments
 (0)