Skip to content

Commit fdd4787

Browse files
authored
Fix segfault when starting playback through the spotify app (#94)
1 parent 5129ba1 commit fdd4787

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/Spotify/SpotifyBackend.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,12 @@ TResult<std::optional<PlaybackTrack>> SpotifyBackend::getCurrentPlayback() {
175175
return std::nullopt;
176176
}
177177

178-
auto const &spotifyPlayingTrack =
179-
playback.value().getCurrentPlayingTrack().value();
178+
auto const &spotifyPlayingTrackOpt =
179+
playback.value().getCurrentPlayingTrack();
180+
if (!spotifyPlayingTrackOpt.has_value()) {
181+
return std::nullopt;
182+
}
183+
auto const &spotifyPlayingTrack = spotifyPlayingTrackOpt.value();
180184

181185
PlaybackTrack playbackTrack;
182186
playbackTrack.trackId = spotifyPlayingTrack.getUri();

0 commit comments

Comments
 (0)