summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@clearboxsystems.com.au>2013-07-01 07:49:50 +1000
committerCarlo Zancanaro <carlo@clearboxsystems.com.au>2013-07-01 07:49:50 +1000
commit9702f336ccc46e0eb0759596c6462963d9f6548d (patch)
treef8470f20c98098e370b3f04ff2a6e1eab6049a85
parenta4863c9ef9986bee2a08f758de3faa53bbf09ebf (diff)
Make sure you never try to take a negative number of things!
-rw-r--r--src/clojure_sql/dsl.clj2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/clojure_sql/dsl.clj b/src/clojure_sql/dsl.clj
index 6d9b413..6ba81bc 100644
--- a/src/clojure_sql/dsl.clj
+++ b/src/clojure_sql/dsl.clj
@@ -371,7 +371,7 @@
(-> query (take 10) (drop 2)) = (-> query (drop 2) (take 8))"
[query n]
(let [query (if-let [old-take (:take query)]
- (assoc query :take (- old-take n))
+ (assoc query :take (max (- old-take n) 0))
query)]
(if-let [old-drop (:drop query)]
(assoc query :drop (+ old-drop n))