Skip to content

Conversation

thdxr
Copy link

@thdxr thdxr commented Apr 24, 2012

Put in a check for value == string.Empty instead of just checking if value == null.

…alue == string.Empty instead of just checking if value == null.
@johnsheehan
Copy link
Contributor

Switch it to string.IsNullOrEmpty() and we'll pull it in.

@petejohanson
Copy link
Contributor

Hrm... we can't easily just use String.IsNullOrEmpty since value is only of type System.Object.

As such, this patch as is works, but feels a bit "dirty" to me checking an object instance against String.Empty using ==. Thoughts on using:

if (value == null || String.IsNullOrEmpty (value.ToString()))

?

@ayoung
Copy link
Contributor

ayoung commented Jul 2, 2012

if (value == null || String.IsNullOrEmpty (value as string))

@ayoung
Copy link
Contributor

ayoung commented Jul 2, 2012

Scratch that. That would cause it to almost always be true.

@petejohanson
Copy link
Contributor

Also, @swearword do you have a simple XML document that demonstrates the problem?

ayoung added a commit that referenced this pull request Jan 11, 2013
XmlAttributeDeserializer crashes if value == ""
@ayoung ayoung merged commit cc283fb into restsharp:master Jan 11, 2013
@ayoung
Copy link
Contributor

ayoung commented Jan 11, 2013

Finally got this in. :) Thanks.

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.

4 participants