Skip to content

Commit

Permalink
fix empty score dump error
Browse files Browse the repository at this point in the history
  • Loading branch information
Yikai-Liao committed Dec 27, 2023
1 parent 01694d9 commit e37533e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ python_add_library(core MODULE src/symusic.cpp WITH_SOABI)
target_link_libraries(core PRIVATE pybind11::headers)

if(BUILD_TEST)
add_executable(note_count test/note_count.cpp)
add_executable(dump test/dump.cpp)
add_executable(note_count tests/note_count.cpp)
add_executable(dump tests/dump.cpp)
endif()

if(NOT MSVC AND NOT ${CMAKE_BUILD_TYPE} MATCHES Debug|RelWithDebInfo)
Expand Down
4 changes: 3 additions & 1 deletion include/Score.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1485,7 +1485,9 @@ minimidi::file::MidiFile Score<T>::to_midi() const {
));
}
utils::sort_msgs(msgs);
midi.tracks.emplace_back(std::move(msgs));
if (!msgs.empty()) {
midi.tracks.emplace_back(std::move(msgs));
}
}

for(const auto &track: tracks) {
Expand Down

0 comments on commit e37533e

Please sign in to comment.