mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-16 23:06:03 +00:00
Fixed warning C28182: Dereferencing NULL pointer. 'streams[j]' contains the same NULL value as 'stream' did.
This commit is contained in:
@@ -1771,7 +1771,14 @@ int SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int
|
||||
if (retval != 0) {
|
||||
int j;
|
||||
for (j = 0; j <= i; j++) {
|
||||
#ifdef _MSC_VER /* Visual Studio analyzer can't tell that we've already verified streams[j] isn't NULL */
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 28182)
|
||||
#endif
|
||||
SDL_UnlockMutex(streams[j]->lock);
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1782,6 +1789,10 @@ int SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int
|
||||
// Now that everything is verified, chain everything together.
|
||||
const SDL_bool iscapture = device->iscapture;
|
||||
for (int i = 0; i < num_streams; i++) {
|
||||
#ifdef _MSC_VER /* Visual Studio analyzer can't tell that streams[i] isn't NULL if retval is 0 */
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 28182)
|
||||
#endif
|
||||
SDL_AudioStream *stream = streams[i];
|
||||
|
||||
stream->bound_device = logdev;
|
||||
@@ -1800,6 +1811,9 @@ int SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int
|
||||
}
|
||||
|
||||
SDL_UnlockMutex(stream->lock);
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user