- BFD_ASSERT (isection != NULL);
- BFD_ASSERT (isection->bfd_section != NULL);
- BFD_ASSERT (isection->bfd_section->output_section != NULL);
+ if (isection == NULL
+ || isection->bfd_section == NULL
+ || isection->bfd_section->output_section == NULL)
+ {
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB(%pA): info section index cannot be set because the section is not in the output"),
+ obfd, osec);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+