mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-10-02 07:42:25 -05:00
Merge pull request #1090 from Santarh/nullCheck
Add null check in StringExtension
This commit is contained in:
@@ -76,6 +76,11 @@ namespace UniGLTF
|
||||
// https://docs.unity3d.com/Manual/BestPracticeUnderstandingPerformanceInUnity5.html
|
||||
public static bool FastStartsWith(this string a, string b)
|
||||
{
|
||||
if (a == null || b == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var aLen = a.Length;
|
||||
var bLen = b.Length;
|
||||
if (aLen < bLen)
|
||||
@@ -94,6 +99,11 @@ namespace UniGLTF
|
||||
|
||||
public static bool FastEndsWith(this string a, string b)
|
||||
{
|
||||
if (a == null || b == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var aLen = a.Length;
|
||||
var bLen = b.Length;
|
||||
if (aLen < bLen)
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace UniGLTF
|
||||
}
|
||||
else
|
||||
{
|
||||
return Path.GetExtension(uri).ToLower();
|
||||
return Path.GetExtension(uri)?.ToLowerInvariant() ?? string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user