Author: bklaas
Date: Tue Jun  1 12:44:37 2010
New Revision: 8837

URL: http://svn.slimdevices.com/jive?rev=8837&view=rev
Log:
Fixed Bug: 16230
Description: initialize self.localPlayer for local players that call 
notify_playerCurrent()
if self.localPlayer is not available when openAlarmWindow() is called, try to 
get it then as well

Modified:
    
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua

Modified: 
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua?rev=8837&r1=8836&r2=8837&view=diff
==============================================================================
--- 
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
 (original)
+++ 
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
 Tue Jun  1 12:44:37 2010
@@ -282,6 +282,9 @@
 
 function notify_playerCurrent(self, player)
        log:info("notify_playerCurrent(", player, ")")
+       if player:isLocal() then
+               self.localPlayer = player
+       end
 end
 
 
@@ -408,6 +411,17 @@
 end
 
 function openAlarmWindow(self, caller)
+
+       -- Bug 16230: if self.localPlayer hasn't been set, try to here as it's 
essential to the alarm working
+       if not self.localPlayer then
+               log:warn('openAlarmWindow: called without self.localPlayer 
being set. try to acquire it now')
+               self.localPlayer = Player:getLocalPlayer()
+               -- if that returns nil (very unlikely), throw an error and 
return
+               if not self.localPlayer then
+                       log:error('openAlarmWindow: without self.localPlayer 
the alarm cannot sound')
+                       return
+               end
+       end
 
        log:warn('openAlarmWindow()', caller, ' ', 
self.localPlayer:isConnected())
 
@@ -462,10 +476,6 @@
                        log:warn('openAlarmWindow: fallback alarm activation')
                else
                        log:warn('openAlarmWindow: fallback alarm snooze or 
explicit audio cycle')                      
-               end
-               if not self.localPlayer then
-                       log:warn('openAlarmWindow: cannot play an alarm without 
a player')
-                       return
                end
 
                self:soundFallbackAlarm()

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins

Reply via email to