Skip to content

Commit 23ba17d

Browse files
Fix crash & add usecase
1 parent 9805f0c commit 23ba17d

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

data/gui/dialogs/ghost_replay_info_dialog.stkgui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</div>
3737
<bubble id="info" width="100%" proportion="1" word_wrap="true"/>
3838
</div>
39-
39+
<spacer width="10" height="5%"/>
4040
<div width="95%" height="40%" align="center">
4141
<buttonbar id="actions" x="0" y="0" height="100%" width="100%" align="center">
4242
<icon-button id="back" width="128" height="128"
@@ -53,7 +53,7 @@
5353
I18N="Ghost replay info screen action" text="Start Race" word_wrap="true" />
5454
</buttonbar>
5555
</div>
56-
<spacer width="10" height="10%"/>
56+
<spacer width="10" height="5%"/>
5757
</div>
5858
</div>
5959

data/replay/benchmark_black_forest.replay

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ reverse: 0
77
difficulty: 3
88
mode: time-trial
99
track: black_forest
10+
info: Sped up 2x for benchmarking purpose.
1011
laps: 1
1112
min_time: 73.286743
1213
replay_uid: 564944495606616311

src/replay/replay_play.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,10 @@ bool ReplayPlay::addReplayFile(const std::string& fn, bool custom_replay, int ca
290290
if (s[last - 1] == '\n')
291291
s[last - 1] = '\0';
292292

293-
rd.m_info = s + 6;
293+
rd.m_info = s + 6;
294+
if (rd.m_info.empty())
295+
rd.m_info = L" ";
296+
294297
fgets(s, 1023, fd);
295298
}
296299
if (sscanf(s, "laps: %u", &rd.m_laps) != 1)
@@ -368,7 +371,7 @@ void ReplayPlay::loadFile(bool second_replay)
368371
ReplayData &rd = m_replay_file_list[replay_index];
369372
unsigned int num_kart = (unsigned int)m_replay_file_list.at(replay_index)
370373
.m_kart_list.size();
371-
unsigned int lines_to_skip = (rd.m_replay_version == 3) ? 7 : 10;
374+
unsigned int lines_to_skip = (rd.m_replay_version == 3) ? 7 : 10 + !rd.m_info.empty();
372375
lines_to_skip += (rd.m_replay_version == 3) ? num_kart : 2*num_kart;
373376

374377
for (unsigned int i = 0; i < lines_to_skip; i++)

0 commit comments

Comments
 (0)