Skip to content

Commit

Permalink
#922 Test if active before reducing the number of active toasts.
Browse files Browse the repository at this point in the history
  • Loading branch information
TimJ0212 committed Apr 5, 2022
1 parent 6994d25 commit 1827964
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/toastr/toastr.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ export class ToastrService {
}
found.activeToast.toastRef.close();
this.toasts.splice(found.index, 1);
this.currentlyActive = this.currentlyActive - 1;
if(this.toasts[this.currentlyActive]) {
this.currentlyActive = this.currentlyActive - 1;
}
if (!this.toastrConfig.maxOpened || !this.toasts.length) {
return false;
}
Expand Down

0 comments on commit 1827964

Please sign in to comment.