diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-06-01 14:01:02 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-06-01 14:01:02 -0700 |
commit | 9703c9a871cf19cc05a034184b5f7ead971bd080 (patch) | |
tree | ea4c50b5de9f9e232918e0967f6cf18f7c2f52c0 | |
parent | 44103879a68941af1550178c9869eec7f69fad4b (diff) | |
download | vyatta-cfg-qos-9703c9a871cf19cc05a034184b5f7ead971bd080.tar.gz vyatta-cfg-qos-9703c9a871cf19cc05a034184b5f7ead971bd080.zip |
Handle missing rate value more gracefully
-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 |