Skip to content

Commit

Permalink
Avoid JSON errors on Windows with no sound devices (#76782)
Browse files Browse the repository at this point in the history
* Avoid JSON errors on Windows with no sound devices

* Obey clang-tidy
  • Loading branch information
alef authored Oct 3, 2024
1 parent c9f96e6 commit 1c24d32
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/sdlsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ static std::string current_playlist;
static size_t current_playlist_at = 0;
static size_t absolute_playlist_at = 0;
static std::vector<std::size_t> playlist_indexes;
static bool sound_init_success = false;
bool sound_init_success = false;
static std::map<std::string, music_playlist> playlists;
static cata_path current_soundpack_path;

Expand Down
1 change: 1 addition & 0 deletions src/sdlsound.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ void play_music( const std::string &playlist );
void stop_music();
void update_music_volume();
void load_soundset();
extern bool sound_init_success;

#else

Expand Down
5 changes: 3 additions & 2 deletions src/sdltiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ static uint32_t lastupdate = 0;
static uint32_t interval = 25;
static bool needupdate = false;
static bool need_invalidate_framebuffers = false;

palette_array windowsPalette;

static Font_Ptr font;
Expand Down Expand Up @@ -3724,7 +3723,9 @@ void catacurses::init_interface()
init_colors();

// initialize sound set
load_soundset();
if( sound_init_success ) {

Check failure on line 3726 in src/sdltiles.cpp

View workflow job for this annotation

GitHub Actions / Clang 12, Ubuntu, Tiles, ASan

use of undeclared identifier 'sound_init_success'
load_soundset();
}

font = std::make_unique<FontFallbackList>( renderer, format, fl.fontwidth, fl.fontheight,
windowsPalette, fl.typeface, fl.fontsize, fl.fontblending );
Expand Down

0 comments on commit 1c24d32

Please sign in to comment.