mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Prevent trying to save null media tags, and report their presence to stderror.
This commit is contained in:
@@ -539,7 +539,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
sidecar = preSidecar;
|
||||
}
|
||||
|
||||
if(dev.IsUsb)
|
||||
if(dev.IsUsb && dev.UsbDescriptors != null)
|
||||
{
|
||||
dumpLog.WriteLine("Reading USB descriptors.");
|
||||
UpdateStatus?.Invoke("Reading USB descriptors.");
|
||||
@@ -559,7 +559,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
};
|
||||
}
|
||||
|
||||
if(dev.IsPcmcia)
|
||||
if(dev.IsPcmcia && dev.Cis != null)
|
||||
{
|
||||
dumpLog.WriteLine("Reading PCMCIA CIS.");
|
||||
UpdateStatus?.Invoke("Reading PCMCIA CIS.");
|
||||
|
||||
@@ -1801,6 +1801,12 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
if(!aborted)
|
||||
foreach(KeyValuePair<MediaTagType, byte[]> tag in mediaTags)
|
||||
{
|
||||
if(tag.Value is null)
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Error: Tag type {0} is null, skipping...", tag.Key);
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = outputPlugin.WriteMediaTag(tag.Value, tag.Key);
|
||||
|
||||
if(ret || force) continue;
|
||||
@@ -1873,7 +1879,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
from partition in xmlTrack.FileSystemInformation
|
||||
where partition.FileSystems != null
|
||||
from fileSystem in partition.FileSystems
|
||||
select ((ulong)partition.StartSector, fileSystem.Type));
|
||||
select (partition.StartSector, fileSystem.Type));
|
||||
|
||||
if(filesystems.Count > 0)
|
||||
foreach(var filesystem in filesystems.Select(o => new {o.start, o.type}).Distinct())
|
||||
|
||||
@@ -684,6 +684,12 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
if(opticalDisc)
|
||||
foreach(KeyValuePair<MediaTagType, byte[]> tag in mediaTags)
|
||||
{
|
||||
if(tag.Value is null)
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Error: Tag type {0} is null, skipping...", tag.Key);
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = outputPlugin.WriteMediaTag(tag.Value, tag.Key);
|
||||
|
||||
if(ret || force) continue;
|
||||
@@ -698,7 +704,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
{
|
||||
if(!dev.IsRemovable || dev.IsUsb)
|
||||
{
|
||||
if(dev.IsUsb)
|
||||
if(dev.IsUsb && dev.UsbDescriptors != null)
|
||||
{
|
||||
UpdateStatus?.Invoke("Reading USB descriptors.");
|
||||
dumpLog.WriteLine("Reading USB descriptors.");
|
||||
|
||||
@@ -883,6 +883,12 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
|
||||
foreach(KeyValuePair<MediaTagType, byte[]> tag in mediaTags)
|
||||
{
|
||||
if(tag.Value is null)
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Error: Tag type {0} is null, skipping...", tag.Key);
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = outputPlugin.WriteMediaTag(tag.Value, tag.Key);
|
||||
if(ret || force) continue;
|
||||
|
||||
|
||||
@@ -1612,6 +1612,13 @@ namespace DiscImageChef.DiscImages
|
||||
foreach(KeyValuePair<MediaTagType, byte[]> mediaTag in mediaTags)
|
||||
{
|
||||
DataType dataType = GetDataTypeForMediaTag(mediaTag.Key);
|
||||
|
||||
if(mediaTag.Value is null)
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Tag type {0} is null, skipping...", dataType);
|
||||
continue;
|
||||
}
|
||||
|
||||
idxEntry = new IndexEntry
|
||||
{
|
||||
blockType = BlockType.DataBlock, dataType = dataType, offset = (ulong)imageStream.Position
|
||||
|
||||
Reference in New Issue
Block a user