grade can be null

This commit is contained in:
2023-02-26 21:57:24 +01:00
parent 1a8c163fc4
commit d8ac2a7ee7
2 changed files with 7 additions and 3 deletions

View File

@@ -43,7 +43,7 @@ public class CombatZones {
/// Returns the given combat zone difficulty as an integer, so it can be sorted.
/// 0 = lowest difficulty, 1 = medium and so forth.
/// </summary>
public static int? DifficultyRank(string difficulty) {
public static int? DifficultyRank(string? difficulty) {
Dictionary<string, int> ranks = new() {
{ DifficultyLow, 0 },
{ DifficultyMedium, 1 },
@@ -51,6 +51,10 @@ public class CombatZones {
{ DifficultyVeryHigh, 3 }
};
if (difficulty == null ) {
return null;
}
if (ranks.TryGetValue(difficulty, out int rank)) {
return rank;
}