Null Reference exception in C#
I'm experiencing "null reference exception" when I'm attempting to return a value from a structure. here is the code: AssetItem item = new AssetItem(); item = initModified(); bool found = false; int index = getIndex(barcode); string modifiedFile = filepath + "Modified\\" + dir + "\\" + index + ".asdt"; if(File.Exists(modifiedFile)) { using(StreamReader reader = new StreamReader(modifiedFile)) { string line = reader.ReadLine(); while(line.Trim()!="") { string[] split = line.Split(','); if(split[1]==barcode) { found = true; break; } line = reader.ReadLine(); } reader.Close(); } } if(found) {