Permalink
Browse files

protect Object.keys use against null

  • Loading branch information...
1 parent 602d771 commit cbee2ec956f042abec2c7767b84fa95b8e0156e9 @jdub committed Feb 19, 2011
Showing with 2 additions and 3 deletions.
  1. +2 −3 lib/twitter.js
View
@@ -7,8 +7,7 @@ var VERSION = '0.1.15',
function merge(defaults, options) {
defaults = defaults || {};
- options = options || {};
- if (typeof options === 'object') {
+ if (options && typeof options === 'object') {
var keys = Object.keys(options);
for (var i = 0, len = keys.length; i < len; i++) {
var k = keys[i];
@@ -127,7 +126,7 @@ Twitter.prototype.post = function(url, content, content_type, callback) {
url = this.options.rest_base + url;
// Workaround: oauth + booleans == broken signatures
- if (typeof content === 'object') {
+ if (content && typeof content === 'object') {
Object.keys(content).forEach(function(e) {
if ( typeof content[e] === 'boolean' )
content[e] = content[e].toString();

0 comments on commit cbee2ec

Please sign in to comment.