diff --git a/src/rest.cpp b/src/rest.cpp index ec76a9ed396..c9c3db2903b 100644 --- a/src/rest.cpp +++ b/src/rest.cpp @@ -540,7 +540,9 @@ int Rest::GetRestOffsetFromOptions( RestLayer layer, const std::pair &location, bool isTopLayer) const { int duration = this->GetActualDur(); - if (duration > DURATION_128) duration = DURATION_128; + // Make sure we are in the boundaries of g_defaultRests + if (duration > DUR_128) duration = DUR_128; + if (duration < DUR_LG) duration = DUR_LG; return g_defaultRests.at(layer) .at(RL_sameLayer == layer ? location.second : RA_none) .at(isTopLayer ? RLP_restOnTopLayer : RLP_restOnBottomLayer)