From 3f884e71e53e722b4647fe5cef7b86dad0ef7c5f Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Tue, 20 May 2014 11:25:32 -0700 Subject: [PATCH] Fixed the LevelLoader in headless settings. --- app/lib/LevelLoader.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/lib/LevelLoader.coffee b/app/lib/LevelLoader.coffee index 8b682b7c1..0252daf7b 100644 --- a/app/lib/LevelLoader.coffee +++ b/app/lib/LevelLoader.coffee @@ -171,10 +171,12 @@ module.exports = class LevelLoader extends CocoClass someLeft = true thangType = spriteSheetResource.thangType if thangType.loaded and not thangType.loading - @listenTo spriteSheetResource.thangType, 'build-complete', @onBuildComplete keys = @buildSpriteSheetsForThangType spriteSheetResource.thangType - spriteSheetResource.spriteSheetKeys = keys - spriteSheetResource.markLoaded() if keys.length is 0 + if keys and keys.length + @listenTo spriteSheetResource.thangType, 'build-complete', @onBuildComplete + spriteSheetResource.spriteSheetKeys = keys + else + spriteSheetResource.markLoaded() clearInterval @buildLoopInterval unless someLeft