Browse Source

serialize IPC to avoid duplicate reference nulling

Paul Frazee 5 years ago
parent
commit
d32f7b52a6
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      app/lib/muxrpc-ipc.js

+ 7
- 1
app/lib/muxrpc-ipc.js View File

@@ -26,6 +26,12 @@ module.exports = function (window, sbot, params) {
26 26
     var ipcPush = pushable()
27 27
     ipc.on('muxrpc-ssb', function (e, msg) {
28 28
       if (e.sender == window.webContents) {
29
+        try {
30
+          if (typeof msg == 'string')
31
+            msg = JSON.parse(msg)
32
+        } catch (e) {
33
+          return
34
+        }
29 35
         if (msg.bvalue) {
30 36
           msg.value = new Buffer(msg.bvalue, 'base64')
31 37
           delete msg.bvalue
@@ -40,7 +46,7 @@ module.exports = function (window, sbot, params) {
40 46
           msg.bvalue = msg.value.toString('base64')
41 47
           delete msg.value
42 48
         }
43
-        window.webContents.send('muxrpc-ssb', msg)
49
+        window.webContents.send('muxrpc-ssb', JSON.stringify(msg))
44 50
       },
45 51
       function (err) { if (err) { console.error(err) } }
46 52
     ))

Loading…
Cancel
Save