Crash in juce_mac_Network.mm

Hi
I suddenly got some crashes when using the URL class.
My code is trying to download an image like this

URL imgUrl;
imgUrl.readEntireBinaryStream(imgData);

This has worked fine in the past, but I update the Juce code to the latest version, and I’m now getting crashes with this call.
I’m not sure what the root cause is, but I have tracked the issue down to the WebInputStream class and the connect function.

On about line 968 it calls:

if (! connection->start (owner, webInputListener))

Problem is that connection might be null (for reasons I don´t know), this will of course lead to an access violation.

inserting a check just before the “start” code seems to fix the issue.
I added this on line 967 of juce_mac_Network.mm and all seems good.

if (connection == nullptr ) return false;

I should add that I run my code in a separate thread, not the message thread, is this not OK?

are you on the develop branch?
it seems it has been fixed a few days ago : https://github.com/WeAreROLI/JUCE/commit/b27116607fd1af6e44a95fe6d5d449d6b8506c52

Hi
No we try to stay on the main brach as this project is live.
I will check out the develop branch.
thank you

I’ve just cherry-picked the fix onto the master branch.