From: <sv...@op...> - 2025-06-09 16:37:30
|
Author: manx Date: Mon Jun 9 18:37:23 2025 New Revision: 23435 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=23435 Log: [Fix] openmpt123: Guard against libsndfile returning nullptr as file extension when matching the file format. Modified: trunk/OpenMPT/openmpt123/openmpt123_sndfile.hpp Modified: trunk/OpenMPT/openmpt123/openmpt123_sndfile.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123_sndfile.hpp Mon Jun 9 08:24:14 2025 (r23434) +++ trunk/OpenMPT/openmpt123/openmpt123_sndfile.hpp Mon Jun 9 18:37:23 2025 (r23435) @@ -117,7 +117,7 @@ case match_recurse: break; case match_exact: - if ( mpt::transcode<std::string>( sndfile_encoding, extension ) == format_info.extension ) { + if ( format_info.extension && ( mpt::transcode<std::string>( sndfile_encoding, extension ) == format_info.extension ) ) { if ( flags.use_float && ( subformat_info.format == SF_FORMAT_FLOAT ) ) { return matched_result( format, format_info, subformat_info, match_mode ); } else if ( !flags.use_float && ( subformat_info.format == SF_FORMAT_PCM_16 ) ) { @@ -126,7 +126,7 @@ } break; case match_better: - if ( mpt::transcode<std::string>( sndfile_encoding, extension ) == format_info.extension ) { + if ( format_info.extension && ( mpt::transcode<std::string>( sndfile_encoding, extension ) == format_info.extension ) ) { if ( flags.use_float && ( subformat_info.format == SF_FORMAT_FLOAT || subformat_info.format == SF_FORMAT_DOUBLE ) ) { return matched_result( format, format_info, subformat_info, match_mode ); } else if ( !flags.use_float && ( subformat_info.format & ( subformat_info.format == SF_FORMAT_PCM_16 || subformat_info.format == SF_FORMAT_PCM_24 || subformat_info.format == SF_FORMAT_PCM_32 ) ) ) { @@ -135,7 +135,7 @@ } break; case match_any: - if ( mpt::transcode<std::string>( sndfile_encoding, extension ) == format_info.extension ) { + if ( format_info.extension && ( mpt::transcode<std::string>( sndfile_encoding, extension ) == format_info.extension ) ) { return matched_result( format, format_info, subformat_info, match_mode ); } break; |