ToString() issue with TMPro conversion

Hi!
This system uses the old Unity text, which I’ve been updating to TMPro. It runs perfectly with the old Unity Text in place. No errors and correct functionality. But since converting to TMPro (with no other changes) I’m getting a runtime error: NullReferenceException: Object reference not set to an instance of an object

The relevant TMPro object is placed inside the public variable stackText.

Here are the relevant pieces of code:

using TMPro;

public TextMeshProUGUI stackText;

    public void SetStack(int stack)
   {
       this.stack = stack;
       if (stack == int.MaxValue)
       {
           stackText.text = "∞";
       }
       else
       {
           stackText.text = this.stack.ToString(); // this is the line throwing the error
        }
       UpdateCondition();
   }

I’m struggling to convert the int to a string. I’ve done plenty of research over the last few hours without success. Would love someone to hint at why it’s throwing the error.

Thank you! (This looks like a scripting problem, but the code is correct (I think)…my guess is it’s a TMP specific quirk…hence this forum.)

I’ve got it sorted…I used the Text to TMPro converter on it in another module and it did a better job than my manual attempt. Copied it over and all is well.