Add some asserts to check for negative trims.
authorCarl Hetherington <cth@carlh.net>
Wed, 13 Oct 2021 19:21:10 +0000 (21:21 +0200)
committerCarl Hetherington <cth@carlh.net>
Wed, 13 Oct 2021 19:22:10 +0000 (21:22 +0200)
src/lib/content.cc

index 49ab944be54c79c3d478469ad09762a9555768fe..b6f7ebbaafa1284bbce648ebe7e58829d0b2fbbe 100644 (file)
@@ -255,6 +255,8 @@ Content::set_position (shared_ptr<const Film> film, DCPTime p, bool force_emit)
 void
 Content::set_trim_start (ContentTime t)
 {
 void
 Content::set_trim_start (ContentTime t)
 {
+       DCPOMATIC_ASSERT (t.get() >= 0);
+
        /* video and audio content can modify its start trim */
 
        if (video) {
        /* video and audio content can modify its start trim */
 
        if (video) {
@@ -278,6 +280,8 @@ Content::set_trim_start (ContentTime t)
 void
 Content::set_trim_end (ContentTime t)
 {
 void
 Content::set_trim_end (ContentTime t)
 {
+       DCPOMATIC_ASSERT (t.get() >= 0);
+
        ContentChangeSignaller cc (this, ContentProperty::TRIM_END);
 
        {
        ContentChangeSignaller cc (this, ContentProperty::TRIM_END);
 
        {