Edzelf / Esp-radio

Internet radio based on Esp8266 and VS1053.
MIT License
628 stars 199 forks source link

"Test" command crash if the stream is stopped (i.e. when mp3client == NULL) #207

Open Derek-K opened 3 years ago

Derek-K commented 3 years ago

https://github.com/Edzelf/Esp-radio/blob/56e57fcaece56d0447246fa4f6be938c7ae0bb09/Esp_radio.ino#L2959-L2963

"Test" command will crash if the stream is stopped.

Fix: check if mp3client is Null

  else if ( argument == "test" )                      // Test command
  {
    if (mp3client)
    {
      sprintf ( reply, "Free memory is %d, ringbuf %d, stream %d",
              system_get_free_heap_size(), rcount, mp3client->available() ) ;
    } else {
      sprintf ( reply, "Free memory is %d, ringbuf %d, No stream available",
              system_get_free_heap_size(), rcount ) ;      
    }
  }