KeepAlive() change request in the api

  • 1
  • Question
  • Updated 11 months ago
  • Acknowledged
In radio.cs, the KeepAlive() function has an if block to check if:

if (!API.ProgramName.Contains("Maestro"))

Any chance that can be changed to check for the existence of ProgramName to prevent a null reference exception?  Something like this:

if ((API.ProgramName != null && API.ProgramName != "") && !API.ProgramName.Contains("Maestro"))

Thanks!
Photo of Robbie - KI4TTZ

Robbie - KI4TTZ

  • 480 Posts
  • 77 Reply Likes

Posted 11 months ago

  • 1
Photo of Mark - W3II

Mark - W3II

  • 133 Posts
  • 33 Reply Likes
I am guessing they do not check for this because you should set this value before calling Init.
Here is what I do for FRStack

API.ProgramName = "FRStack";
API.Init();


Photo of Robbie - KI4TTZ

Robbie - KI4TTZ

  • 480 Posts
  • 77 Reply Likes
Yeah I've modified my code to do that now, just took a sec to figure out why it was blowing up. Either way, not a huge deal.

Now I gotta figure out why keepalive isn't actually keeping it alive. Haven't played with the API in a few years...It has changed quite a bit. :-)
Photo of Eric - KE5DTO

Eric - KE5DTO, Official Rep

  • 712 Posts
  • 208 Reply Likes
Note that KeepAlive doesn't run in Debug mode.  Only in Release.
Photo of Eric - KE5DTO

Eric - KE5DTO, Official Rep

  • 712 Posts
  • 208 Reply Likes
Indeed, a ProgramName should be set before calling API.Init.  However, it could be checked and something more sensible shown to help the developer figure this out.  I've entered issue #5528 to address this.  Thanks for the report.