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

bug in error handling? #10

Open
jdmuys opened this issue Jan 26, 2012 · 1 comment
Open

bug in error handling? #10

jdmuys opened this issue Jan 26, 2012 · 1 comment

Comments

@jdmuys
Copy link

jdmuys commented Jan 26, 2012

I am receiving empty data from well formed YAML (at least according to http://yaml-online-parser.appspot.com/). I traced through the code and I believe there is a bug in the code when the optional NSError argument passed is not nil. This happens in:

 + (NSMutableArray *) YAMLWithStream: (NSInputStream *) stream  options: (YAMLReadOptions) opt error: (NSError **) error

Where you find this test:

  if (error) {
      yaml_document_delete(&document);
  }

If the error passed is not nil, then this test passes even if there is no actual parsing error. I believe the test should be:

  if (*error) {
      yaml_document_delete(&document);
  }

(also note that the pattern is not faithful to the Cocoa NSError pattern where you should only look at the NSError if you diagnosed the occurrence of an error in some other way. A non-nil error is not necessarily a good test for error, as we could have warnings, non-fatal errors, recovered errors… Now of course, this is no big deal. You can diverge from Cocoa patterns if you like).

@axello
Copy link

axello commented Jul 12, 2012

Thanks! Was about to submit the same error but will now upgrade to the latest and greatest version.

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

No branches or pull requests

2 participants