1 diff --git a/src/raptor_xml_writer.c b/src/raptor_xml_writer.c
2 index 56993dc3..163f34d5 100644
3 --- a/src/raptor_xml_writer.c
4 +++ b/src/raptor_xml_writer.c
5 @@ -216,6 +216,9 @@ raptor_xml_writer_start_element_common(raptor_xml_writer* xml_writer,
7 if(nstack && element->attributes) {
8 for(i = 0; i < element->attribute_count; i++) {
9 + if (nspace_declarations_count > element->attribute_count)
13 if(element->attributes[i]->nspace) {
14 /* Check if we need a namespace declaration attribute */