Permalink
Browse files

Whoops, don't crash when the db is empty

  • Loading branch information...
1 parent 8b1cc14 commit 082be86e787a7d776b96b7b16678f3c1d826b63a @boutell committed Feb 6, 2013
Showing with 13 additions and 10 deletions.
  1. +12 −9 jot.js
  2. +1 −1 package.json
View
21 jot.js
@@ -538,15 +538,18 @@ function jot() {
}
function loadersThenCallback(area) {
- if (options.load) {
- return callLoadersForArea(area, after);
- } else {
- return after();
- }
- function after() {
- return callback(null, area);
- }
-
+ if (!area) {
+ // Careful, this is not an error, don't crash
+ return callback(null, null);
+ }
+ if (options.load) {
+ return callLoadersForArea(area, after);
+ } else {
+ return after();
+ }
+ function after() {
+ return callback(null, area);
+ }
}
};
View
@@ -1,6 +1,6 @@
{
"name": "node-jot",
- "version": "0.3.1",
+ "version": "0.3.2",
"description": "Jot is a rich content and rich text editor. In addition to rich text, jot allows you to add rich media to documents. Jot also includes simple facilities for storing your rich content areas in MongoDB and fetching them back again.",
"main": "jot.js",
"dependencies": {

0 comments on commit 082be86

Please sign in to comment.