Don't create destination stream if backup source doesn't exist

This commit is contained in:
Dean Herbert 2022-08-17 18:20:47 +09:00
parent fca076b988
commit e1e6be039a

View File

@ -901,13 +901,13 @@ namespace osu.Game.Database
try
{
using (var source = storage.GetStream(Filename, mode: FileMode.Open))
using (var destination = storage.GetStream(backupFilename, FileAccess.Write, FileMode.CreateNew))
{
// source may not exist.
if (source == null)
return;
source.CopyTo(destination);
using (var destination = storage.GetStream(backupFilename, FileAccess.Write, FileMode.CreateNew))
source.CopyTo(destination);
}
return;