Skip to content

Commit b4f88af

Browse files
committed
null check in text formatter
1 parent 799f0b1 commit b4f88af

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ PythonShell.defaultOptions = {};
107107
// built-in formatters
108108
PythonShell.format = {
109109
text: function toText(data) {
110-
if (typeof data !== 'string') return data.toString();
110+
if (!data) return '';
111+
else if (typeof data !== 'string') return data.toString();
111112
return data;
112113
},
113114
json: function toJson(data) {

0 commit comments

Comments
 (0)