Skip to content

Commit

Permalink
Fix crash on absent config file
Browse files Browse the repository at this point in the history
  • Loading branch information
zakwilson committed Mar 31, 2017
1 parent 63c1446 commit 34bea93
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/clojure/com/flashlightdb/ceilingbounce/common.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
[neko.ui :as ui]
[neko.threading :refer [on-ui]]
[neko.find-view :refer [find-view]]
[amalloy.ring-buffer :refer [ring-buffer]])
[amalloy.ring-buffer :refer [ring-buffer]]
[clojure.java.io :as io])
(:use overtone.at-at)
(:import android.media.RingtoneManager))

Expand Down Expand Up @@ -44,8 +45,10 @@

(defn read-config
([] (read-config config-path))
([path] (swap! config merge
(read-string (slurp path)))))
([path]
(when (.exists (io/as-file path))
(swap! config merge
(read-string (slurp path))))))

(defn write-config
([conf] (write-config config-path conf))
Expand Down

0 comments on commit 34bea93

Please sign in to comment.