Don't throw error if broadcastArray is undefined

This commit is contained in:
Piotr Sarnacki 2015-11-10 09:58:37 +01:00
parent ab0b0cbebc
commit c40e413f35
2 changed files with 4 additions and 2 deletions

View File

@ -33,7 +33,7 @@ export default DS.RESTAdapter.extend({
// be to create my own URL generator
_buildURL: function(modelName, id) {
var url = [];
var host = get(this, 'host');
var host = Ember.get(this, 'host');
var prefix = this.urlPrefix();
var path;

View File

@ -18,6 +18,8 @@ Controller = Ember.Controller.extend
).property('user.gravatarId')
defineTowerColor: (broadcastArray) ->
return '' unless broadcastArray
if broadcastArray.length
if broadcastArray.findBy('category', 'warning')
return 'warning'
@ -75,7 +77,7 @@ Controller = Ember.Controller.extend
id = broadcast.get('id').toString()
seenBroadcasts = @get('storage').getItem('travis.seen_broadcasts')
if seenBroadcasts
seenBroadcasts = JSON.parse(seenBroadcasts)
seenBroadcasts = JSON.parse(seenBroadcasts)
else
seenBroadcasts = []
seenBroadcasts.push(id)