Skip to content

Commit

Permalink
avoid localtime() exception if param is undef
Browse files Browse the repository at this point in the history
if localtime() parameter is undef, it will generate an exception.
To avoid that, we check first if $time is true.

Jairo and Mario, you deserve a big thanks for this bug.

closes: #1813

Reported-by: Mario Jorge De Sousa Freire <mario.freire@camara.gov.br>
Reported-by: Jairo C de Oliveira <olivejai@gmail.com>
  • Loading branch information
Gonéri Le Bouder committed Dec 13, 2012
1 parent e5978e9 commit b8658ec
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/FusionInventory/Agent/Tools.pm
Expand Up @@ -57,6 +57,8 @@ if ($OSNAME ne 'MSWin32') {
sub getFormatedLocalTime {
my ($time) = @_;

return unless $time;

my ($year, $month , $day, $hour, $min, $sec) =
(localtime ($time))[5, 4, 3, 2, 1, 0];

Expand Down

0 comments on commit b8658ec

Please sign in to comment.