mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Null items are no fun
This commit is contained in:
@@ -63,7 +63,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
EnsureKey(key);
|
EnsureKey(key);
|
||||||
|
|
||||||
// Now return the value
|
// Now return the value
|
||||||
return Items[key];
|
return Items[key].Where(i => i != null).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -295,6 +295,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <param name="item">Item to remove info for</param>
|
/// <param name="item">Item to remove info for</param>
|
||||||
public void RemoveItem(DatItem item)
|
public void RemoveItem(DatItem item)
|
||||||
{
|
{
|
||||||
|
// If we have a null item, we can't do anything
|
||||||
|
if (item == null)
|
||||||
|
return;
|
||||||
|
|
||||||
// No matter what the item is, we increate the count
|
// No matter what the item is, we increate the count
|
||||||
lock (_lockObject)
|
lock (_lockObject)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace SabreTools.Library.Tools
|
|||||||
{
|
{
|
||||||
string filename = Path.GetFileName(path);
|
string filename = Path.GetFileName(path);
|
||||||
if (sanitize)
|
if (sanitize)
|
||||||
filename.Replace(Path.DirectorySeparatorChar, '-').Replace(Path.AltDirectorySeparatorChar, '-');
|
filename = filename.Replace(Path.DirectorySeparatorChar, '-').Replace(Path.AltDirectorySeparatorChar, '-');
|
||||||
|
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ namespace SabreTools.Library.Tools
|
|||||||
{
|
{
|
||||||
string filename = Path.GetFileName(child);
|
string filename = Path.GetFileName(child);
|
||||||
if (sanitize)
|
if (sanitize)
|
||||||
filename.Replace(Path.DirectorySeparatorChar, '-').Replace(Path.AltDirectorySeparatorChar, '-');
|
filename = filename.Replace(Path.DirectorySeparatorChar, '-').Replace(Path.AltDirectorySeparatorChar, '-');
|
||||||
|
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,7 @@ namespace SabreTools.Library.Tools
|
|||||||
{
|
{
|
||||||
string filename = child.Remove(0, parent.Length + 1);
|
string filename = child.Remove(0, parent.Length + 1);
|
||||||
if (sanitize)
|
if (sanitize)
|
||||||
filename.Replace(Path.DirectorySeparatorChar, '-').Replace(Path.AltDirectorySeparatorChar, '-');
|
filename = filename.Replace(Path.DirectorySeparatorChar, '-').Replace(Path.AltDirectorySeparatorChar, '-');
|
||||||
|
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user