summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-06-03 10:50:02 +0100
committerSteve Kemp <steve@steve.org.uk>2015-06-03 10:50:02 +0100
commitaae77b2c370a366fd11ca36f55a915af511bdb5a (patch)
tree3b95b4d8be458e719e37cc144cdf7a6165d8559b
parent9b4e13bc53bd89997c6d9441559410d60cb60480 (diff)
Ensure that we don't use null variables.
If we're sorting an empty array then return that empty array and save the pain of working with undefined time.attributes, & etc.
-rw-r--r--lib/byteback/backup_directory.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/byteback/backup_directory.rb b/lib/byteback/backup_directory.rb
index bdfc29c..f485297 100644
--- a/lib/byteback/backup_directory.rb
+++ b/lib/byteback/backup_directory.rb
@@ -11,6 +11,8 @@ module Byteback
BACKUP_IMPORTANCE = [1, 2, 7, 14, 21, 28, 56, 112]
def sort_by_importance(snapshots_unsorted, now=Time.now)
+ return snapshots_unsorted if ( snapshots_unsorted.size < 1 )
+
#
# Keep the last 7 days backups
#