diff --git a/rdf/base/src/nsContainerCursor.cpp b/rdf/base/src/nsContainerCursor.cpp index a6664dc71f22..85631cb98207 100644 --- a/rdf/base/src/nsContainerCursor.cpp +++ b/rdf/base/src/nsContainerCursor.cpp @@ -184,6 +184,9 @@ ContainerCursorImpl::Advance(void) if (NS_FAILED(rv = mDataSource->GetTarget(mContainer, kRDF_nextVal, PR_TRUE, &nextNode))) goto done; + if (rv == NS_RDF_NO_VALUE) + goto done; + if (NS_FAILED(rv = nextNode->QueryInterface(kIRDFLiteralIID, (void**) &nextVal))) goto done; diff --git a/rdf/base/src/nsRDFXMLDataSource.cpp b/rdf/base/src/nsRDFXMLDataSource.cpp index 9f176552a6c0..f7ef592dd6ee 100644 --- a/rdf/base/src/nsRDFXMLDataSource.cpp +++ b/rdf/base/src/nsRDFXMLDataSource.cpp @@ -1214,6 +1214,10 @@ RDFXMLDataSourceImpl::SerializeMember(nsIOutputStream* aStream, if (NS_FAILED(rv = cursor->GetTarget(&node))) break; + NS_ASSERTION(rv != NS_RDF_NO_VALUE, "null item in cursor"); + if (rv == NS_RDF_NO_VALUE) + continue; + // If it's a resource, then output a "" // tag, because we'll be dumping the resource separately. (We // iterate thru all the resources in the datasource, diff --git a/rdf/base/src/rdfutil.cpp b/rdf/base/src/rdfutil.cpp index 2eea7ff5a749..6903926cd56d 100644 --- a/rdf/base/src/rdfutil.cpp +++ b/rdf/base/src/rdfutil.cpp @@ -728,6 +728,9 @@ rdf_ContainerGetNextValue(nsIRDFDataSource* ds, if (NS_FAILED(rv = ds->GetTarget(container, kRDF_nextVal, PR_TRUE, &nextValNode))) goto done; + if (rv == NS_RDF_NO_VALUE) + goto done; + if (NS_FAILED(rv = nextValNode->QueryInterface(kIRDFLiteralIID, (void**) &nextValLiteral))) goto done; @@ -841,6 +844,10 @@ rdf_ContainerRemoveElement(nsIRDFDataSource* aDataSource, return rv; } + NS_ASSERTION(rv != NS_RDF_NO_VALUE, "null item in cursor"); + if (rv == NS_RDF_NO_VALUE) + continue; + PRBool eq; if (NS_FAILED(rv = element->EqualsNode(aElement, &eq))) { NS_ERROR("severe error on equality check"); @@ -886,6 +893,10 @@ rdf_ContainerRemoveElement(nsIRDFDataSource* aDataSource, return rv; } + NS_ASSERTION(rv != NS_RDF_NO_VALUE, "null value in cursor"); + if (rv == NS_RDF_NO_VALUE) + continue; + if (NS_FAILED(rv = elements->GetLabel(getter_AddRefs(ordinal)))) { NS_ERROR("unable to get element's ordinal index"); return rv; @@ -1032,6 +1043,10 @@ rdf_ContainerInsertElementAt(nsIRDFDataSource* aDataSource, return rv; } + NS_ASSERTION(rv != NS_RDF_NO_VALUE, "null value in cursor"); + if (rv == NS_RDF_NO_VALUE) + continue; + if (NS_FAILED(rv = aDataSource->Unassert(aContainer, ordinal, element))) { NS_ERROR("unable to remove element from container"); return rv; @@ -1115,6 +1130,10 @@ rdf_ContainerIndexOf(nsIRDFDataSource* aDataSource, return rv; } + NS_ASSERTION(rv != NS_RDF_NO_VALUE, "null value in cursor"); + if (rv == NS_RDF_NO_VALUE) + continue; + // Okay, we've found it. nsCOMPtr ordinal; if (NS_FAILED(rv = elements->GetLabel(getter_AddRefs(ordinal)))) { diff --git a/rdf/content/src/nsRDFMenuBuilder.cpp b/rdf/content/src/nsRDFMenuBuilder.cpp index 39a8ffe4633b..b94411eceb64 100644 --- a/rdf/content/src/nsRDFMenuBuilder.cpp +++ b/rdf/content/src/nsRDFMenuBuilder.cpp @@ -277,6 +277,10 @@ RDFMenuBuilderImpl::AddWidgetItem(nsIContent* aElement, return rv; } + NS_ASSERTION(rv != NS_RDF_NO_VALUE, "arc-out with no target: fix your arcs-out cursor!"); + if (rv == NS_RDF_NO_VALUE) + continue; + nsCOMPtr resource; nsCOMPtr literal; diff --git a/rdf/content/src/nsRDFToolbarBuilder.cpp b/rdf/content/src/nsRDFToolbarBuilder.cpp index a8db17b7901b..8070a22fcc1e 100644 --- a/rdf/content/src/nsRDFToolbarBuilder.cpp +++ b/rdf/content/src/nsRDFToolbarBuilder.cpp @@ -259,6 +259,10 @@ RDFToolbarBuilderImpl::AddWidgetItem(nsIContent* aElement, return rv; } + NS_ASSERTION(rv != NS_RDF_NO_VALUE, "arc-out with no target: fix your arcs out cursor"); + if (rv == NS_RDF_NO_VALUE) + continue; + nsCOMPtr resource; nsCOMPtr literal; diff --git a/rdf/content/src/nsRDFTreeBuilder.cpp b/rdf/content/src/nsRDFTreeBuilder.cpp index a8699e955ceb..dfafa9191262 100644 --- a/rdf/content/src/nsRDFTreeBuilder.cpp +++ b/rdf/content/src/nsRDFTreeBuilder.cpp @@ -593,6 +593,10 @@ RDFTreeBuilderImpl::AddWidgetItem(nsIContent* aElement, return rv; } + NS_ASSERTION(rv != NS_RDF_NO_VALUE, "arc-out with no target: fix your arcs-out cursor"); + if (rv == NS_RDF_NO_VALUE) + continue; + nsCOMPtr resource; nsCOMPtr literal; diff --git a/rdf/content/src/nsRDFXULBuilder.cpp b/rdf/content/src/nsRDFXULBuilder.cpp index 5b1da8b9482c..23ea736f1860 100644 --- a/rdf/content/src/nsRDFXULBuilder.cpp +++ b/rdf/content/src/nsRDFXULBuilder.cpp @@ -573,6 +573,10 @@ RDFXULBuilderImpl::CreateContents(nsIContent* aElement) return rv; } + NS_ASSERTION(rv != NS_RDF_NO_VALUE, "null value in cursor"); + if (rv == NS_RDF_NO_VALUE) + continue; + if (NS_FAILED(AppendChild(aElement, child))) { NS_ERROR("problem appending child to content model"); return rv; @@ -1446,6 +1450,11 @@ RDFXULBuilderImpl::CreateElement(nsIRDFResource* aResource, return rv; } + NS_ASSERTION(rv != NS_RDF_NO_VALUE, "no node type"); + if (rv == NS_RDF_NO_VALUE) + return NS_ERROR_UNEXPECTED; + + nsCOMPtr type; if (NS_FAILED(rv = typeNode->QueryInterface(kIRDFResourceIID, getter_AddRefs(type)))) { NS_ERROR("type wasn't a resource"); @@ -1573,6 +1582,10 @@ RDFXULBuilderImpl::CreateHTMLElement(nsIRDFResource* aResource, return rv; } + NS_ASSERTION(rv != NS_RDF_NO_VALUE, "null value in cursor"); + if (rv == NS_RDF_NO_VALUE) + continue; + // Add the attribute to the newly constructed element if (NS_FAILED(rv = AddAttribute(element, property, value))) { NS_ERROR("unable to add attribute to element");