last_100 crash

Hi,
After a reboot (system freeze) , I was unable to play anything except the first song of my playlist.
The systemd journal, show me that last_100.js was crashing the volumio.service.
Here is the problematic function :

[code]/**

  • listen to changes in the state, saves them and write them on file
    */
    last_100.prototype.listenState = function () {
    var self = this;

    var socket= io.connect(‘http://localhost:3000’);
    socket.emit(‘getState’, ‘’);

    socket.on(‘pushState’, function(data) {

     var newlastStates = [];
     if (data.status != 'stop' && data.service != 'webradio' && data.volatile != true){
         if (data.uri != currentSong.uri){
             currentSong.uri = data.uri;
             var currentsong = {uri:data.uri, service:data.service,title:data.title,
                 artist:data.artist, album:data.album, albumart:data.albumart, type:'song'};
             newlastStates.push(currentsong);
             try {
                 var lastStates = fs.readJsonSync('/data/laststates.json', {throws: false});
             } catch (e) {
                 var lastStates = [];
             }
             if(lastStates.length > 0) {
                 var j = 0;
                 for (var i in lastStates) {
                     if ((lastStates[i].uri != currentSong.uri) && j < 99) {
                         newlastStates.push(lastStates[i]);
                         j++;
                     }
    
                 }
             }
             fs.outputJsonSync("/data/laststates.json", newlastStates);
         }
    
    
     }
    

    })
    }[/code]

In my case, lastStates variable is null (problably because /data/laststates.json was unreadable), causing the crash…
I just change the condition with

if(lastStates != null && lastStates.length > 0) {
...

and everything works fine.

I was reading the fs documentation for readJsonSync : readJsonSync with option {throws: false} return a null object if error occurs, which cause the script crash and volumio.service restart.
Unfortunately, I cannot access to github repository to post a fix ( add defensive programming in both last_100.prototype.listenState and last_100.prototype.handleBrowseUri functions).