mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Prevent image-info to crash if TOC or PMA are empty.
This commit is contained in:
@@ -207,6 +207,8 @@ namespace DiscImageChef.Core
|
|||||||
{
|
{
|
||||||
byte[] toc = imageFormat.ReadDiskTag(MediaTagType.CD_FullTOC);
|
byte[] toc = imageFormat.ReadDiskTag(MediaTagType.CD_FullTOC);
|
||||||
|
|
||||||
|
if(toc.Length > 0)
|
||||||
|
{
|
||||||
ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(toc, 0));
|
ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(toc, 0));
|
||||||
if(dataLen + 2 != toc.Length)
|
if(dataLen + 2 != toc.Length)
|
||||||
{
|
{
|
||||||
@@ -221,12 +223,15 @@ namespace DiscImageChef.Core
|
|||||||
DicConsole.Write("{0}", FullTOC.Prettify(toc));
|
DicConsole.Write("{0}", FullTOC.Prettify(toc));
|
||||||
DicConsole.WriteLine();
|
DicConsole.WriteLine();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(imageFormat.Info.ReadableMediaTags != null &&
|
if(imageFormat.Info.ReadableMediaTags != null &&
|
||||||
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_PMA))
|
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_PMA))
|
||||||
{
|
{
|
||||||
byte[] pma = imageFormat.ReadDiskTag(MediaTagType.CD_PMA);
|
byte[] pma = imageFormat.ReadDiskTag(MediaTagType.CD_PMA);
|
||||||
|
|
||||||
|
if(pma.Length > 0)
|
||||||
|
{
|
||||||
ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(pma, 0));
|
ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(pma, 0));
|
||||||
if(dataLen + 2 != pma.Length)
|
if(dataLen + 2 != pma.Length)
|
||||||
{
|
{
|
||||||
@@ -241,6 +246,7 @@ namespace DiscImageChef.Core
|
|||||||
DicConsole.Write("{0}", PMA.Prettify(pma));
|
DicConsole.Write("{0}", PMA.Prettify(pma));
|
||||||
DicConsole.WriteLine();
|
DicConsole.WriteLine();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(imageFormat.Info.ReadableMediaTags != null &&
|
if(imageFormat.Info.ReadableMediaTags != null &&
|
||||||
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_ATIP))
|
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_ATIP))
|
||||||
|
|||||||
Reference in New Issue
Block a user