n_sheets - 1 - i,
&sheet);
if (css_code != CSS_OK) {
+ /* The API just told us that there were n_sheets
+ * valid sheets. So while we attempt to handle
+ * the error gracefully in production builds,
+ * this should never happen. */
+ assert(0);
+
if (code == svgtiny_OK) {
code = svgtiny_LIBCSS_ERROR;
}
* will not try to access them. */
css_code = css_select_ctx_remove_sheet(state.select_ctx, sheet);
if (css_code != CSS_OK) {
+ /* Same as the assert() above. This sheet arose
+ * from a call to css_select_ctx_get_sheet() a
+ * moment ago, it should be valid! */
+ assert(0);
+
if (code == svgtiny_OK) {
code = svgtiny_LIBCSS_ERROR;
}
continue;
}
css_code = css_stylesheet_destroy((css_stylesheet*)sheet);
- if (css_code != CSS_OK && code == svgtiny_OK) {
- code = svgtiny_LIBCSS_ERROR;
+ if (css_code != CSS_OK) {
+ /* Once more, "sheet" should have been valid
+ * and un-destroyed. */
+ assert(0);
+
+ if (code == svgtiny_OK) {
+ code = svgtiny_LIBCSS_ERROR;
+ }
}
}
css_code = css_select_ctx_destroy(state.select_ctx);