0

I am working on my first game and have encountered an issue using the dreamlo scoreboard asset. It is basically a simple leaderboard system working using only HTTP GET requests, and no PhP/SQL. You can read more about it here: Dreamlo

Using the class coming with the asset, I am getting a NullReferenceException on this function:

public string[] ToStringArray()
{
    if (this.highScores == "") return null;


    string[] rows = this.highScores.Split(new char[] { '\n' }, System.StringSplitOptions.RemoveEmptyEntries);
    return rows;
}

Note that my program runs fine, and leaderboards are shown, but as soon as it gets to this function I am spammed with 19 NullReferenceExceptions.

Cœur
  • 34,719
  • 24
  • 185
  • 251
Sofus Øvretveit
  • 191
  • 1
  • 2
  • 10

1 Answers1

1

Learn more about NullReferenceException.

And try this line:

 if (string.IsNullOrEmpty(this.highScores)) return null;
Cœur
  • 34,719
  • 24
  • 185
  • 251
Umair M
  • 9,448
  • 4
  • 38
  • 72