@@ -1409,6 +1409,9 @@ static Boolean _CFURLComponentsSetQueryItemsInternal(CFURLComponentsRef componen
1409
1409
if ( name && name != kCFNull ) {
1410
1410
if ( addPercentEncoding ) {
1411
1411
CFStringRef stringWithPercentEncoding = _CFStringCreateByAddingPercentEncodingWithAllowedCharacters (kCFAllocatorSystemDefault , name , queryNameValueAllowed );
1412
+ if ( !stringWithPercentEncoding ) {
1413
+ stringWithPercentEncoding = (CFStringRef )CFRetain (CFSTR ("" ));
1414
+ }
1412
1415
CFStringAppendStringToAppendBuffer (& buf , stringWithPercentEncoding );
1413
1416
CFRelease (stringWithPercentEncoding );
1414
1417
}
@@ -1426,6 +1429,9 @@ static Boolean _CFURLComponentsSetQueryItemsInternal(CFURLComponentsRef componen
1426
1429
CFStringAppendCharactersToAppendBuffer (& buf , chars , 1 );
1427
1430
if ( addPercentEncoding ) {
1428
1431
CFStringRef stringWithPercentEncoding = _CFStringCreateByAddingPercentEncodingWithAllowedCharacters (kCFAllocatorSystemDefault , value , queryNameValueAllowed );
1432
+ if ( !stringWithPercentEncoding ) {
1433
+ stringWithPercentEncoding = (CFStringRef )CFRetain (CFSTR ("" ));
1434
+ }
1429
1435
CFStringAppendStringToAppendBuffer (& buf , stringWithPercentEncoding );
1430
1436
CFRelease (stringWithPercentEncoding );
1431
1437
}
@@ -1461,6 +1467,8 @@ static Boolean _CFURLComponentsSetQueryItemsInternal(CFURLComponentsRef componen
1461
1467
return ( result );
1462
1468
}
1463
1469
1470
+
1471
+
1464
1472
CF_EXPORT void _CFURLComponentsSetQueryItems (CFURLComponentsRef components , CFArrayRef names , CFArrayRef values ) {
1465
1473
(void )_CFURLComponentsSetQueryItemsInternal (components , names , values , true); // _CFURLComponentsSetQueryItemsInternal cannot fail if addPercentEncoding is true
1466
1474
}
0 commit comments