BluetoothStatus: don't pass NaNs to native functions
GJS complains when a NaN is passed in place of an integer, and parseInt returns that from non numeric string. Pass a sentinel that cancels the operation in that case. https://bugzilla.gnome.org/show_bug.cgi?id=642978
This commit is contained in:
parent
43cf60f563
commit
25015c9c3a
@ -471,9 +471,15 @@ PinNotification.prototype = {
|
|||||||
|
|
||||||
this.connect('action-invoked', Lang.bind(this, function(self, action) {
|
this.connect('action-invoked', Lang.bind(this, function(self, action) {
|
||||||
if (action == 'ok') {
|
if (action == 'ok') {
|
||||||
if (this._numeric)
|
if (this._numeric) {
|
||||||
this._applet.agent_reply_passkey(this._devicePath, parseInt(this._entry.text));
|
let num = parseInt(this._entry.text);
|
||||||
else
|
if (isNaN(num)) {
|
||||||
|
// user reply was empty, or was invalid
|
||||||
|
// cancel the operation
|
||||||
|
num = -1;
|
||||||
|
}
|
||||||
|
this._applet.agent_reply_passkey(this._devicePath, num);
|
||||||
|
} else
|
||||||
this._applet.agent_reply_pincode(this._devicePath, this._entry.text);
|
this._applet.agent_reply_pincode(this._devicePath, this._entry.text);
|
||||||
} else {
|
} else {
|
||||||
if (this._numeric)
|
if (this._numeric)
|
||||||
|
Loading…
Reference in New Issue
Block a user