Skip to content

Commit

Permalink
RPC: catch responses with invalid characters
Browse files Browse the repository at this point in the history
  • Loading branch information
whphhg committed May 18, 2017
1 parent 306d13e commit 7ae2fdf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vcash-electron",
"productName": "Vcash Electron GUI",
"version": "0.31.2",
"version": "0.31.3",
"description": "Multi-platform and multi-node GUI for Vcash.",
"main": "src/electron.js",
"scripts": {
Expand Down
10 changes: 9 additions & 1 deletion src/stores/rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,15 @@ export default class RPC {
},
body: JSON.stringify(options)
})
.then((response) => { if (response.ok === true) return response.json() })
.then((response) => {
if (response.ok === true) {
try {
return response.json()
} catch (e) {
console.error('Received RPC response with invalid characters.', e)
}
}
})
.then((data) => {
/** Update connection status. */
if (this.connection.status.rpc !== true) {
Expand Down

0 comments on commit 7ae2fdf

Please sign in to comment.