Skip to content

Commit 0cf7c03

Browse files
committed
Prevent the generation of invalid .meta files
1 parent 227b964 commit 0cf7c03

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

src/UnityNuGet/RegistryCache.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace UnityNuGet
3131
public class RegistryCache
3232
{
3333
public static readonly bool IsRunningOnAzure = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME"));
34-
34+
3535
// Change this version number if the content of the packages are changed by an update of this class
3636
private const string CurrentRegistryVersion = "1.6.0";
3737

@@ -209,7 +209,7 @@ private async Task BuildInternal()
209209
// Clear the cache entirely
210210
_npmPackageRegistry.Reset();
211211
}
212-
212+
213213
var regexFilter = Filter != null ? new Regex(Filter, RegexOptions.IgnoreCase) : null;
214214
if (Filter != null)
215215
{
@@ -744,7 +744,17 @@ RegistryEntry packageEntry
744744
// Collect the folders' metas
745745
{
746746
string? fullPath = Path.GetDirectoryName(fileInUnityPackage);
747-
string[] folders = fullPath?.Split(Path.DirectorySeparatorChar) ?? Array.Empty<string>();
747+
string[] folders;
748+
749+
if (!string.IsNullOrEmpty(fullPath))
750+
{
751+
folders = fullPath.Split(Path.DirectorySeparatorChar);
752+
}
753+
else
754+
{
755+
folders = Array.Empty<string>();
756+
}
757+
748758
string folder = string.Empty;
749759

750760
foreach (var relative in folders)

0 commit comments

Comments
 (0)