@@ -260,6 +260,59 @@ main(int argc, char** argv)
260260 assertEqual (marker->color ().c_str (), red);
261261 });
262262
263+ // test to ensure null error_status pointers are correctly handled
264+ tests.add_test (" test_error_ptr_null" , [] {
265+
266+ using namespace otio ;
267+
268+ // tests for no image bounds on media reference on clip
269+ SerializableObject::Retainer<Clip> clip (new Clip);
270+
271+ // check that there is an error, and that it's the correct error
272+ otio::ErrorStatus mr_bounds_error;
273+ clip->available_image_bounds (&mr_bounds_error);
274+ assertTrue (otio::is_error (mr_bounds_error));
275+ assertEqual (
276+ mr_bounds_error.outcome ,
277+ otio::ErrorStatus::CANNOT_COMPUTE_BOUNDS);
278+
279+ // check that if null ptr, nothing happens
280+ otio::ErrorStatus* null_test = nullptr ;
281+
282+ assertEqual (
283+ clip->available_image_bounds (null_test), std::optional<IMATH_NAMESPACE::Box2d>()
284+ );
285+ });
286+
287+ // test to ensure null error_status pointers are correctly handled
288+ // when there's no media reference
289+ tests.add_test (" test_error_ptr_null_no_media" , [] {
290+ using namespace otio ;
291+
292+ SerializableObject::Retainer<Clip> clip (new Clip);
293+
294+ // set media reference to empty
295+ Clip::MediaReferences empty_mrs;
296+ empty_mrs[" empty" ] = nullptr ;
297+ clip->set_media_references (empty_mrs, " empty" );
298+
299+ otio::ErrorStatus bounds_error_no_mr;
300+ clip->available_image_bounds (&bounds_error_no_mr);
301+ assertTrue (otio::is_error (bounds_error_no_mr));
302+
303+ assertEqual (
304+ bounds_error_no_mr.outcome ,
305+ otio::ErrorStatus::CANNOT_COMPUTE_BOUNDS);
306+
307+ // std::cout<< "bounds error details: " << bounds_error_no_mr.details << std::endl;
308+
309+ otio::ErrorStatus* null_test_no_mr = nullptr ;
310+
311+ assertEqual (
312+ clip->available_image_bounds (null_test_no_mr), std::optional<IMATH_NAMESPACE::Box2d>()
313+ );
314+ });
315+
263316 tests.run (argc, argv);
264317 return 0 ;
265318}
0 commit comments