Permalink
Browse files

only run prefix if we have url - needs to validate url too

  • Loading branch information...
1 parent c5a9fd1 commit 0a6145aa64ad14f2b451d0eaf8b90eb5d7650b96 @remy committed Feb 28, 2012
Showing with 12 additions and 10 deletions.
  1. +12 −10 prefix.js
View
@@ -325,16 +325,18 @@ if (!module.parent && process.argv[2]) {
sock.on('message', function(data) {
console.log('work: %s', data);
data = JSON.parse(data);
- var prefix = new Prefix(function () {
- // process.send()
- console.log('all done');
- sock.send(JSON.stringify({ type: 'done ' }));
- });
- prefix.dirtyExit = data.dirtyExit;
-
- console.log('>>' + data.url);
-
- prefix.parseURL(data.url);
+ if (data.url) {
+ var prefix = new Prefix(function () {
+ // process.send()
+ console.log('all done');
+ sock.send(JSON.stringify({ type: 'done ' }));
+ });
+ prefix.dirtyExit = data.dirtyExit;
+ console.log('>>' + data.url);
+ prefix.parseURL(data.url);
+ } else {
+ sock.send(JSON.stringify({ type: 'done ' }));
+ }
});
}

0 comments on commit 0a6145a

Please sign in to comment.