GetKeys Gives a null reference error
Posted: Sun Feb 25, 2024 8:05 am
Hello, i use this function:
public void Elements_LoadAll(List<string> allElementsList)
{
if (allElementsList == null)
{
allElementsList = new List<string>();
}
foreach (string key in ES3.GetKeys("Elements.es3"))
{
if (!allElementsList.Contains(key))
allElementsList.Add(key);
}
}
And if there are no elements in the file "Elements.es3" i get a null reference error. Could i add a check to not avoid the error?
public void Elements_LoadAll(List<string> allElementsList)
{
if (allElementsList == null)
{
allElementsList = new List<string>();
}
foreach (string key in ES3.GetKeys("Elements.es3"))
{
if (!allElementsList.Contains(key))
allElementsList.Add(key);
}
}
And if there are no elements in the file "Elements.es3" i get a null reference error. Could i add a check to not avoid the error?