Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
always pass an int to fromID/fromTabID
Browse files Browse the repository at this point in the history
  • Loading branch information
bridiver committed May 9, 2018
1 parent ec2b1fa commit 3bb5db3
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/browser/api/web-contents.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,14 @@ module.exports = {
},

fromId (id) {
const contents = binding.fromId(id)
if (!id)
return

const parsed = parseInt(id)
if (isNaN(parsed))
return

const contents = binding.fromId(parsed)
if (contents && !contents.isDestroyed()) {
return contents
}
Expand All @@ -248,7 +255,12 @@ module.exports = {
fromTabID (tabID) {
if (!tabID)
return
const contents = binding.fromTabID(tabID)

const parsed = parseInt(tabID)
if (isNaN(parsed))
return

const contents = binding.fromTabID(parsed)
if (contents && !contents.isDestroyed()) {
return contents
}
Expand Down

0 comments on commit 3bb5db3

Please sign in to comment.