Why returns CFURLCreateWithString no valid url (=NULL)?

I wonder, what the cause could be that CFURLCreateWithString returns NULL. Has anybody experienced this behaviour?

Below code add additional checks.

bool juce_launchFile (const String& fileName, 
                      const String& parameters)
    if (fileName.startsWithIgnoreCase (T("http:")))
		bool ok = false;
        CFStringRef urlString = PlatformUtilities::juceStringToCFString (fileName);
			CFURLRef url = CFURLCreateWithString (kCFAllocatorDefault, urlString, 0);
			CFRelease (urlString);
				ok = (LSOpenCFURLRef (url, 0) == noErr);
				CFRelease (url);
        return ok;

Good point. I’ll throw those extra checks in, just in case.

I seem to recall that if the URL isn’t “well formed” (based on such and such standards and definitions – see the apple dev docs) then the CFURL functions can be unpredictable.

Found it :oops: