Prevent image-info to crash if TOC or PMA are empty.

This commit is contained in:
2018-06-23 20:38:54 +01:00
parent 3176377d3d
commit 0689a26e91

View File

@@ -207,6 +207,8 @@ namespace DiscImageChef.Core
{
byte[] toc = imageFormat.ReadDiskTag(MediaTagType.CD_FullTOC);
if(toc.Length > 0)
{
ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(toc, 0));
if(dataLen + 2 != toc.Length)
{
@@ -221,12 +223,15 @@ namespace DiscImageChef.Core
DicConsole.Write("{0}", FullTOC.Prettify(toc));
DicConsole.WriteLine();
}
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_PMA))
{
byte[] pma = imageFormat.ReadDiskTag(MediaTagType.CD_PMA);
if(pma.Length > 0)
{
ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(pma, 0));
if(dataLen + 2 != pma.Length)
{
@@ -241,6 +246,7 @@ namespace DiscImageChef.Core
DicConsole.Write("{0}", PMA.Prettify(pma));
DicConsole.WriteLine();
}
}
if(imageFormat.Info.ReadableMediaTags != null &&
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_ATIP))