Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memcached.item(...) crashes when no items #5

Closed
adkap opened this issue Jul 21, 2011 · 1 comment
Closed

Memcached.item(...) crashes when no items #5

adkap opened this issue Jul 21, 2011 · 1 comment
Labels
bug Issues with confirmed bugs.

Comments

@adkap
Copy link

adkap commented Jul 21, 2011

The result set actually contains [ false ] at line 384 if memcached has no items (fresh startup). Doesn't seem right... but that's what happens.

/root/proxy/modules/memcached/lib/memcached.js:384
var identifier = statSet[0].split(':');
^
TypeError: Cannot call method 'split' of undefined
at /root/proxy/modules/memcached/lib/memcached.js:384:37
at Array.forEach (native)
at Socket. (/root/proxy/modules/memcached/lib/memcached.js:383:17)
at EventEmitter.rawDataReceived (/root/proxy/modules/memcached/lib/memcached.js:478:93)
at EventEmitter.BufferBuffer (/root/proxy/modules/memcached/lib/memcached.js:416:12)
at Socket. (/root/proxy/modules/memcached/lib/utils.js:68:17)
at Socket.emit (events.js:64:17)
at Socket._onReadable (net.js:678:14)
at IOWatcher.onReadable as callback

@adkap
Copy link
Author

adkap commented Jul 21, 2011

This should do it.

diff memcached.js

384,387c384,389
<         var identifier = statSet[0].split(':');
<         
<         if (!response[identifier[1]]) response[identifier[1]] = {};
<         response[identifier[1]][identifier[2]] = statSet[1];
---
>         if (statSet) {
>           var identifier = statSet[0].split(':');
>           
>           if (!response[identifier[1]]) response[identifier[1]] = {};
>           response[identifier[1]][identifier[2]] = statSet[1];
>         }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues with confirmed bugs.
Projects
None yet
Development

No branches or pull requests

2 participants