diff --git a/exec/fseditor.js b/exec/fseditor.js
index 4ae058d8e036c6c7b1d4194f2c0ba7ef6bddf499..1c9b6511684655cecd1e32d8b362960abf5d1668 100644
--- a/exec/fseditor.js
+++ b/exec/fseditor.js
@@ -266,8 +266,13 @@ function unwrap_line(l)
 				line[l].kludged=false;
 		}
 		/* Get first word(s) of next line */
-		re=new RegExp("^(.{1,"+space+"}(?![^\\s])\\s*)","");
-		words=line[l+1].text.match(re);
+		if(space < 1) {
+			words=null;
+		}
+		else {
+			re=new RegExp("^(.{1,"+space+"}(?![^\\s])\\s*)","");
+			words=line[l+1].text.match(re);
+		}
 		if(words != null) {
 			line[l].text+=words[1];
 			line[l].attr+=line[l+1].attr.substr(0,words[1].length);
@@ -1898,4 +1903,4 @@ if(edit_top==5 && info[0]!=subj) {
 console.ctrlkey_passthru=oldpass;
 bbs.sys_status=old_status;
 console.clear();
-exit(exit_code);
\ No newline at end of file
+exit(exit_code);