Skip to content

Commit

Permalink
FIx Timing Copier giving error when copying to an empty beatmap.
Browse files Browse the repository at this point in the history
  • Loading branch information
OliBomby committed Aug 19, 2024
1 parent a6feed5 commit 807b4b1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Mapping_Tools/Views/TimingCopier/TimingCopierView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private string Copy_Timing(TimingCopierVm arg, BackgroundWorker worker, DoWorkEv
// Apply timing changes
TimingPointsChange.ApplyChanges(timingTo, timingPointsChanges);

if (arg.ResnapMode == "Number of beats between objects stays the same") {
if (arg.ResnapMode == "Number of beats between objects stays the same" && redlines.Count > 0) {
redlines = timingTo.Redlines;
List<double> newBookmarks = new List<double>();
double lastTime = redlines.FirstOrDefault().Offset;
Expand Down Expand Up @@ -145,7 +145,7 @@ private string Copy_Timing(TimingCopierVm arg, BackgroundWorker worker, DoWorkEv
}
}
beatmapTo.SetBookmarks(newBookmarks);
} else if (arg.ResnapMode == "Just resnap") {
} else if (arg.ResnapMode == "Just resnap" && redlines.Count > 0) {
// Resnap hitobjects
foreach (HitObject ho in beatmapTo.HitObjects)
{
Expand Down Expand Up @@ -207,6 +207,9 @@ private List<Marker> GetMarkers(Beatmap beatmap, Timing timing) {
// Sort the markers
markers = markers.OrderBy(o => o.Time).ToList();

if (markers.Count == 0)
return markers;

// Calculate the beats between this marker and the last marker
// If there is a redline in between then calculate beats from last marker to the redline and beats from redline to this marker
// Time the same is 0
Expand Down

0 comments on commit 807b4b1

Please sign in to comment.