fix crash in REST API

observed when memcached was crashing constantly

Change-Id: I60c9b8bffcc2f32b5a7b5ea5e8564f1e1c1761f7
Reviewed-on: http://review.couchbase.org/38820
Tested-by: Artem Stemkovski <artem@couchbase.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>