develephant / electangular

AngularJS Module for Atom Electron
MIT License
28 stars 2 forks source link

Possibly unhandled rejection: undefined #3

Open Jass91 opened 7 years ago

Jass91 commented 7 years ago

Hi guys, I'm using Electangular and that's great, but, I tried to show a messagebox from angular, using this code:

electron.dialog.showMessageBox(null, {
    message: "Muito tempo inativo",
    title: "Inatividade",
     buttons  : ["Utilizar Tempo", "Ignorar Tempo"]
})
.then(
       function(r){
         debugger;
         console.log(r);
       },
     function(error){
       debugger;
       console.log(error);
});

when I click at 'Ignorar Tempo' labeled button, all goes fine, but when i click at 'Utilizar Tempo' button, an error occurs, but inside error variable, I have undefined value.

Obs: this occurs with any button at the first position in the buttons array, provided in the options object. I think it occurs, because the first position is 0, a falsy value and therefore we have this error on if clause.

image

Can you fix it? (just change if clause to if (result != 0 && !result) and it will be done)