Fix invalid null checks (caught by cppcheck)

Resolve two instances where values were null checked
after use.
This commit is contained in:
Campbell Barton
2025-02-05 14:31:12 +11:00
parent 77fca5b15a
commit 378e49059e
2 changed files with 12 additions and 7 deletions

View File

@@ -2040,12 +2040,14 @@ static void do_outliner_keyingset_editop(SpaceOutliner *space_outliner,
/* check if RNA-property described by this selected element is an animatable prop */
const TreeElementRNACommon *te_rna = tree_element_cast<TreeElementRNACommon>(te);
PointerRNA ptr = te_rna->get_pointer_rna();
if (te_rna && te_rna->get_property_rna() &&
RNA_property_anim_editable(&ptr, te_rna->get_property_rna()))
{
/* get id + path + index info from the selected element */
tree_element_to_path(te, tselem, &id, &path, &array_index, &flag, &groupmode);
if (te_rna) {
PointerRNA ptr = te_rna->get_pointer_rna();
if (PropertyRNA *prop = te_rna->get_property_rna()) {
if (RNA_property_anim_editable(&ptr, prop)) {
/* get id + path + index info from the selected element */
tree_element_to_path(te, tselem, &id, &path, &array_index, &flag, &groupmode);
}
}
}
/* only if ID and path were set, should we perform any actions */

View File

@@ -37,11 +37,14 @@ void FileBuffer::write_to_file()
void FileBuffer::close_file()
{
if (!outfile_) {
return;
}
int close_status = std::fclose(outfile_);
if (close_status == EOF) {
return;
}
if (outfile_ && close_status) {
if (close_status) {
CLOG_ERROR(&LOG, "Error: could not close file '%s' properly, it may be corrupted.", filepath_);
}
}