How to fix the «Uncaught TypeError: Cannot read property 'addErrorMessage' of undefined» Braintree bug in Magento 2.0.x?

1.

Locate the line:

Replace it with the following one:

(this.messageContainer || messageList).addErrorMessage({

2.

Locate the line:

Replace it with the following one:

(this.messageContainer || messageList).addErrorMessage(error);

3.

Locate the line:

Replace it with the following one:

(this.messageContainer || messageList).addErrorMessage({