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
  • 37,241
  • 25
  • 195
  • 267
Sofus Øvretveit
  • 323
  • 1
  • 3
  • 10

1 Answers1

1

Learn more about NullReferenceException.

And try this line:

 if (string.IsNullOrEmpty(this.highScores)) return null;
Cœur
  • 37,241
  • 25
  • 195
  • 267
Umair M
  • 10,298
  • 6
  • 42
  • 74