Skip to content

Commit 1fb4f44

Browse files
committed
Workaround for issue node-pcap/node_pcap#263
1 parent ce4b0b0 commit 1fb4f44

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

pcap.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module.exports = function(RED) {
3535
msg.payload = raw_packet;
3636
} else {
3737
var decoded = pcap.decode.packet(raw_packet);
38-
38+
3939
if (node.path) {
4040
var pathParts = node.path.split(".");
4141
pathParts.reduce(function(obj, i) {
@@ -47,7 +47,10 @@ module.exports = function(RED) {
4747
if (node.output == "object") {
4848
msg.payload = decoded;
4949
} else if (node.output == "string") {
50-
msg.payload = String(decoded)
50+
msg.payload = '';
51+
if (decoded.payload !== null) {
52+
msg.payload = String(decoded);
53+
}
5154
}
5255
}
5356
msg.topic = node.ifname;

0 commit comments

Comments
 (0)