-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix NSData crash when url or path cannot be opened #554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.x
Are you sure you want to change the base?
Conversation
…ith completion block. Added try-catch to avoid crash when data cannot be loaded.
|
Why have you created a new completion block for this? The old block should be sufficient - but if not, please change ALL the instances, don't create a new, duplicate, typedef. Your new block forces peolpe to duplicate their code and handle both outcomes - and it also appears to discard critical information - you've lost ALL the parse data, no? |
|
Sorry. I was trying to create a simpler and more straight forward block when one just needs the SVGKImage and not the SVGKParseResult object. If you feel strongly about reusing the existing typedef, sure. Yes. I just noticed the wrong completion instance checking. The block is not invoked at all. Sigh |
|
NB: I'm not saying the old block is perfect - the way we signal failure is
a bit opaque, could be made clearer (IIRC we return an SVGKParseResult with
a nil image, and inside the parseresult you can query for how many fatal
errors there were) - but it's a major part of our public interface at the
moment (it's what all user-code currently has to interface with) so I'd
like to keep using it, and/or modify it carefully.
…On 24 January 2018 at 15:34, Steffi ***@***.***> wrote:
Sorry. I was trying to create a simpler and more straight forward
approach. And yeah I just noticed the wrong completion instance checking.
I'll sort everything out and apply to all instances. Thanks!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#554 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAR1-VN7TgrYzOl8JFzHBebnNzQbxS9Tks5tN015gaJpZM4RqplK>
.
|
|
Noted. Will keep that in mind. |
|
UPDATE: now we've started a 3.x branch ... it's a good time to improve / fix any interfaces. I don't think this one is easy :) - there's a lot of information to handle (the extra metadata needed by the parser, the image that's created (or null), and the parse-errors, and separately the parse-log), but now is a good time to come up with a cleaner alternative if you have one in mind. |
Added try-catch-finally to avoid fatal exception when loading image contents of a path or url.
Use:
+[SVGKImage imageWithContentsOfURL:completion:]+[SVGKImage imageWithContentsOfFile:completion:]