* \param node Libdom SVG node on which to store the data
* \param libcss_node_data Pointer to the data to store
*
- * \return Always returns CSS_OK
+ * \return CSS_OK on success, or CSS_NOMEM on error
*/
css_error set_libcss_node_data(void *pw, void *node,
void *libcss_node_data)
{
struct svgtiny_parse_state *state;
void *old_data;
+ dom_exception err;
/* A unique "userdata key" (a string) is used to identify this
* data. */
state = (struct svgtiny_parse_state *)pw;
- dom_node_set_user_data((dom_node *)node,
- state->interned_userdata_key,
- libcss_node_data,
- svgtiny_dom_user_data_handler,
- &old_data);
+ err = dom_node_set_user_data((dom_node *)node,
+ state->interned_userdata_key,
+ libcss_node_data,
+ svgtiny_dom_user_data_handler,
+ &old_data);
+
+ if (err == DOM_NO_MEM_ERR) {
+ return CSS_NOMEM;
+ }
- /* dom_node_set_user_data() always returns DOM_NO_ERR */
+ /* dom_node_set_user_data() only has two return values, okay
+ and not-okay. */
return CSS_OK;
}