Skip to content
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

Prevent crashes when calling deprecated functions #6

Merged
merged 1 commit into from
May 7, 2012
Merged

Prevent crashes when calling deprecated functions #6

merged 1 commit into from
May 7, 2012

Conversation

kristopherjohnson
Copy link
Contributor

Deprecated functions such as +[TBXML tbxmlWithXMLData:] were passing a null error pointer to other methods. This leads to a crash if an error occurs and the error-handling code doesn't check for a null pointer before setting the error.

These methods are deprecated, so callers shouldn't be using them, but legacy code should not crash.

This commit solves that problem by creating a local NSError reference and passing a pointer to that. For example:

- (id)initWithXMLData:(NSData*)aData {
    NSError *error = nil;
    return [self initWithXMLData:aData error:&error];
}

A test case has been added. This test case crashed before the fixes were made.

Tpbradley pushed a commit that referenced this pull request May 7, 2012
Prevent crashes when calling deprecated functions
@Tpbradley Tpbradley merged commit 3c9cdce into codebots-ltd:master May 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants