Skip to content

Commit

Permalink
Don't throw in SongReader/VideoReader if XNB path doesn't normalize.
Browse files Browse the repository at this point in the history
Thanks to @redmcg for identifying this inaccuracy!
  • Loading branch information
flibitijibibo committed Jun 3, 2024
1 parent e86dbcc commit 65f98a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Content/ContentReaders/SongReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ protected internal override Song Read(ContentReader input, Song existingInstance
/* The path string includes the ".wma" extension. Let's see if this
* file exists in a format we actually support...
*/
path = Normalize(path.Substring(0, path.Length - 4));
if (String.IsNullOrEmpty(path))
string realPath = Normalize(path.Substring(0, path.Length - 4));
if (!String.IsNullOrEmpty(realPath))
{
throw new ContentLoadException();
path = realPath;
}

int durationMs = input.ReadInt32();
Expand Down
6 changes: 3 additions & 3 deletions src/Content/ContentReaders/VideoReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ Video existingInstance
/* The path string includes the ".wmv" extension. Let's see if this
* file exists in a format we actually support...
*/
path = Normalize(path.Substring(0, path.Length - 4));
if (String.IsNullOrEmpty(path))
string realPath = Normalize(path.Substring(0, path.Length - 4));
if (!String.IsNullOrEmpty(realPath))
{
throw new ContentLoadException();
path = realPath;
}

int durationMS = input.ReadObject<int>();
Expand Down

0 comments on commit 65f98a8

Please sign in to comment.