Skip to content

Commit 1111c3b

Browse files
author
AJubrey
committed
[ADDED] a few checks to make sure we never try to call a method on a null string
[CHANGED] I was clobbering a variable when i didn't mean to
1 parent a4bb14e commit 1111c3b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,22 +283,28 @@ public static string[] DCCVendorLocations {
283283
if (!string.IsNullOrEmpty(location))
284284
{
285285
//If we are on Windows, we need only go up one location to get to the "Autodesk" folder.
286-
var possibleLocation = Directory.GetParent(location).ToString();
286+
string possibleLocation = location;
287+
if (Directory.GetParent(location) != null)
288+
{
289+
possibleLocation = Directory.GetParent(location).ToString();
290+
}
287291

288292
if (Application.platform == RuntimePlatform.OSXEditor)
289293
{
290294
int appIndex = location.IndexOf("Maya.app");
291295

292296
//If we found 'Maya.app' in the location string, we're going to trim it and everything after it out
293297
//This way our possibleLocation will be more uniform between windows and mac
294-
if (appIndex != -1)
298+
if (appIndex >= 0 &&
299+
Directory.GetParent(location) != null &&
300+
Directory.GetParent(Directory.GetParent(location).ToString()) != null)
295301
{
296302
possibleLocation = location.Substring(0, (appIndex - 1));
297-
possibleLocation = Directory.GetParent(Directory.GetParent(location).ToString()).ToString();
303+
possibleLocation = Directory.GetParent(Directory.GetParent(possibleLocation).ToString()).ToString();
298304
}
299305
}
300306

301-
if (Directory.Exists(possibleLocation))
307+
if (!string.IsNullOrEmpty(possibleLocation) && Directory.Exists(possibleLocation))
302308
{
303309
locationsList.Add(possibleLocation.ToString());
304310
}

0 commit comments

Comments
 (0)