diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Vyatta/Qos/Util.pm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Vyatta/Qos/Util.pm b/lib/Vyatta/Qos/Util.pm index 151b1d3..242e2b4 100644 --- a/lib/Vyatta/Qos/Util.pm +++ b/lib/Vyatta/Qos/Util.pm @@ -27,6 +27,9 @@ use base qw(Exporter); sub get_num { use POSIX qw(strtod); my ($str) = @_; + return unless $str; + + # remove leading/trailing spaces $str =~ s/^\s+//; $str =~ s/\s+$//; @@ -86,6 +89,8 @@ sub getAutoRate { sub getRate { my $rate = shift; + $rate or die "Rate not defined"; + my ( $num, $suffix ) = get_num($rate); defined $num |