Skip to content

Commit 7990f11

Browse files
committed
Remove unnecessary null checks
1 parent 427f7c9 commit 7990f11

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

SabreTools.Serialization/Readers/ISO9660.cs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class ISO9660 : BaseBinaryReader<Volume>
3838

3939
// Read the set of Volume Descriptors
4040
var vdSet = ParseVolumeDescriptorSet(data, sectorLength);
41-
if (vdSet == null || vdSet.Length == 0)
41+
if (vdSet.Length == 0)
4242
return null;
4343

4444
volume.VolumeDescriptorSet = vdSet;
@@ -74,7 +74,7 @@ public class ISO9660 : BaseBinaryReader<Volume>
7474
/// <param name="data">Stream to parse</param>
7575
/// <param name="sectorLength">Number of bytes in a logical sector (usually 2048)</param>
7676
/// <returns>Filled VolumeDescriptor[] on success, null on error</returns>
77-
public static VolumeDescriptor[]? ParseVolumeDescriptorSet(Stream data, short sectorLength)
77+
public static VolumeDescriptor[] ParseVolumeDescriptorSet(Stream data, short sectorLength)
7878
{
7979
var obj = new List<VolumeDescriptor>();
8080

@@ -199,11 +199,7 @@ public class ISO9660 : BaseBinaryReader<Volume>
199199
obj.PathTableLocationM = data.ReadInt32BigEndian();
200200
obj.OptionalPathTableLocationM = data.ReadInt32BigEndian();
201201

202-
var dr = ParseDirectoryRecord(data, true);
203-
if (dr == null)
204-
return null;
205-
206-
obj.RootDirectoryRecord = dr;
202+
obj.RootDirectoryRecord = ParseDirectoryRecord(data, true);
207203

208204
obj.VolumeSetIdentifier = data.ReadBytes(128);
209205
obj.PublisherIdentifier = data.ReadBytes(128);
@@ -266,11 +262,7 @@ public class ISO9660 : BaseBinaryReader<Volume>
266262
obj.PathTableLocationM = data.ReadInt32BigEndian();
267263
obj.OptionalPathTableLocationM = data.ReadInt32BigEndian();
268264

269-
var dr = ParseDirectoryRecord(data, true);
270-
if (dr == null)
271-
return null;
272-
273-
obj.RootDirectoryRecord = dr;
265+
obj.RootDirectoryRecord = ParseDirectoryRecord(data, true);
274266

275267
obj.VolumeSetIdentifier = data.ReadBytes(128);
276268
obj.PublisherIdentifier = data.ReadBytes(128);
@@ -414,7 +406,7 @@ public class ISO9660 : BaseBinaryReader<Volume>
414406

415407
// Parse the path table group in the base volume descriptor
416408
var pathTableGroups = ParsePathTableGroup(data, sectorLength, bvd);
417-
if (pathTableGroups != null && pathTableGroups.Count > 0)
409+
if (pathTableGroups.Count > 0)
418410
groups.AddRange(pathTableGroups);
419411
}
420412

@@ -432,7 +424,7 @@ public class ISO9660 : BaseBinaryReader<Volume>
432424
/// <param name="sectorLength">Number of bytes in a logical sector (usually 2048)</param>
433425
/// <param name="vd">Primary/Supplementary/Enhanced Volume Descriptor pointing to path table(s)</param>
434426
/// <returns>Filled list of PathTableGroup on success, null on error</returns>
435-
public static List<PathTableGroup>? ParsePathTableGroup(Stream data, short sectorLength, BaseVolumeDescriptor vd)
427+
public static List<PathTableGroup> ParsePathTableGroup(Stream data, short sectorLength, BaseVolumeDescriptor vd)
436428
{
437429
var groups = new List<PathTableGroup>();
438430

0 commit comments

Comments
 (0)