Skip to content
This repository
Browse code

Merge pull request #1847 from mikrohard/pvr-wakeup

Only use valid CDateTime objects for pvr wakeup command
  • Loading branch information...
commit 2d81d77660a0bebddb20d6a632cc2c909a7c07a4 2 parents f528cd3 + 1090ed4
Lars Op den Kamp authored November 30, 2012
23  xbmc/pvr/PVRManager.cpp
@@ -275,16 +275,19 @@ bool CPVRManager::SetWakeupCommand(void)
275 275
   {
276 276
     time_t iWakeupTime;
277 277
     const CDateTime nextEvent = m_timers->GetNextEventTime();
278  
-    nextEvent.GetAsTime(iWakeupTime);
279  
-
280  
-    CStdString strExecCommand;
281  
-    strExecCommand.Format("%s %d", strWakeupCommand, iWakeupTime);
282  
-
283  
-    const int iReturn = system(strExecCommand.c_str());
284  
-    if (iReturn != 0)
285  
-      CLog::Log(LOGERROR, "%s - failed to execute wakeup command '%s': %s (%d)", __FUNCTION__, strExecCommand.c_str(), strerror(iReturn), iReturn);
286  
-
287  
-    return iReturn == 0;
  278
+    if (nextEvent.IsValid())
  279
+    {
  280
+      nextEvent.GetAsTime(iWakeupTime);
  281
+        
  282
+      CStdString strExecCommand;
  283
+      strExecCommand.Format("%s %d", strWakeupCommand, iWakeupTime);
  284
+        
  285
+      const int iReturn = system(strExecCommand.c_str());
  286
+      if (iReturn != 0)
  287
+        CLog::Log(LOGERROR, "%s - failed to execute wakeup command '%s': %s (%d)", __FUNCTION__, strExecCommand.c_str(), strerror(iReturn), iReturn);
  288
+        
  289
+      return iReturn == 0;
  290
+    }
288 291
   }
289 292
 
290 293
   return false;
2  xbmc/pvr/timers/PVRTimers.cpp
@@ -685,7 +685,7 @@ CDateTime CPVRTimers::GetNextEventTime(void) const
685 685
       const CDateTimeSpan oneDay(1,0,0,0);
686 686
       dailywakeuptime += oneDay;
687 687
     }
688  
-    if (dailywakeuptime < wakeuptime)
  688
+    if (!wakeuptime.IsValid() || dailywakeuptime < wakeuptime)
689 689
       wakeuptime = dailywakeuptime;
690 690
   }
691 691
 

0 notes on commit 2d81d77

Please sign in to comment.
Something went wrong with that request. Please try again.