MikeStall / DataTable

Class library for working with tabular data, especially CSV files
Apache License 2.0
150 stars 63 forks source link

FlattenWorker throws NullReferenceException with null values #1

Closed charliehayesmps closed 12 years ago

charliehayesmps commented 12 years ago

The first line in the FlattenWorker method: Type t = item.GetType();

Throws a NullReferenceException when the value of the property being flattened is null.

It should probably do a null check on item and just add null or empty string to the List vals parameter.

MikeStall commented 12 years ago

I can fix that. Would you like me to deploy a new nuget package, or are you just pulling from the sources directly?

I'm curious what System.Type you're passing to FlattenWorker? If it's non-trivial, I can add a test case for it.

Mike

-----Original Message----- From: charliehayesmps Sent: Monday, April 23, 2012 9:16 AM To: Mike Stall Subject: [DataTable] FlattenWorker throws NullReferenceException with null values (#1)

The first line in the FlattenWorker method: Type t = item.GetType();

Throws a NullReferenceException when the value of the property being flattened is null.


Reply to this email directly or view it on GitHub: https://github.com/MikeStall/DataTable/issues/1

charliehayesmps commented 12 years ago

I'm passing a complex type in but the actual property it's choking on is just a string.

I'm using NuGet; I've worked around the problem by adding ?? string.empty to all the strings in my linq query.

-Charlie

MikeStall commented 12 years ago

Fixed, updated nuget feed.