Is it possible :incoming-message is mapped to nil?

On Fri, Oct 16, 2015 at 2:33 PM, Lawrence Krubner <lawre...@rollioforce.com>
wrote:

> What am I doing wrong here? I want to call clojure.string/lower-case  on
> the :incoming-message of this-users-conversation. If there is no message, I
> return an empty string.
>
>
> (defn discern-current-state [this-users-conversation]
>   (cond
>     (= (clojure.string/lower-case (get this-users-conversation
> :incoming-message "")) "yes") (assoc this-users-conversation :current-state
> :salesforce-write)
>
>
> and yet the error points to the above line:
>
> java.lang.NullPointerException {:class java.lang.NullPointerException,
> :message nil, :trace-elems ({:anon-fn false, :fn "lower-case", :ns
> "clojure.string", :clojure true, :file "string.clj", :line 215} {:anon-fn
> false, :fn "discern-current-state", :ns "nlph.event-bus", :clojure true,
> :file "event_bus.clj", :line 92}
>
>
> but of course, at the REPL, everything works as I would expect:
>
> (def users {:message "hello"})
> #'nlph.core/users
>
> nlph.core=> (clojure.string/lower-case (get users :message))
> "hello"
>
> nlph.core=> (clojure.string/lower-case (get users :message ""))
> "hello"
>
> nlph.core=> (clojure.string/lower-case (get users :lisa))
>
> NullPointerException   clojure.string/lower-case (string.clj:215)
>
> nlph.core=> (clojure.string/lower-case (get users :lisa ""))
> ""
>
> nlph.core=> (clojure.string/lower-case (get users :lisa))
>
> NullPointerException   clojure.string/lower-case (string.clj:215)
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to