Markdown shortcode doesn't support optional params

I created a shortcut, that accepts markdown like this

{{% foo %}} ## test{{% /foo % }}

but when I try to add an optional parameter:

{{% foo bar="test" %}} ## test{{% /foo % }}

and in the shortcode:

{{ with .Get "bar" }}<h1>{{ . }}</h1>{{ end }}

hugo fails with ERR: reflect: call of reflect.Value.Len on zero Value for all places where I didn’t added the param. Is this expected behavior or a bug?

A bug.

But I think this is fixed in The latest Hugo source.