Navigation Menu

Skip to content

Commit

Permalink
[fix] Remove .free, it's removed
Browse files Browse the repository at this point in the history
[fix] Don't crash on undefined page references
  • Loading branch information
3rd-Eden committed Jun 20, 2014
1 parent bc0921c commit 1ceb0bd
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions primus.js
Expand Up @@ -30,14 +30,11 @@ module.exports = function connection(spark) {
// to that page so we can get the correct pagelet instances.
//
case 'page':
if (page && page.free) page.free();

//
// As part of setting a new Page instance, we need to release the
// previously added pagelet
//
Object.keys(pagelets).forEach(function free(name) {
if (pagelets[name].free) pagelets[name].free();
delete pagelets[name];
});

Expand Down Expand Up @@ -90,11 +87,9 @@ module.exports = function connection(spark) {
spark.once('end', function end() {
debug('closed connection');

if (page.free) page.free();
spark.page = page = null;

Object.keys(pagelets).forEach(function free(name) {
if (pagelets[name].free) pagelets[name].free();
delete pagelets[name];
});
});
Expand Down

0 comments on commit 1ceb0bd

Please sign in to comment.