mirror of
https://github.com/RetroDECK/org.mamedev.MAME.git
synced 2025-01-19 02:55:39 +00:00
Avoid a null deref in sound output
This commit is contained in:
parent
e40d93c007
commit
dd609a8a62
|
@ -81,3 +81,5 @@ modules:
|
|||
path: mame.ini
|
||||
- type: patch
|
||||
path: floppy.patch
|
||||
- type: patch
|
||||
path: sound.patch
|
||||
|
|
28
sound.patch
Normal file
28
sound.patch
Normal file
|
@ -0,0 +1,28 @@
|
|||
diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp
|
||||
index a0293063..c4989abb 100644
|
||||
--- a/src/emu/sound.cpp
|
||||
+++ b/src/emu/sound.cpp
|
||||
@@ -761,6 +761,9 @@ read_stream_view sound_stream::update_view(attotime start, attotime end, u32 out
|
||||
}
|
||||
g_profiler.stop();
|
||||
|
||||
+ if (!m_output_view[outputnum].valid())
|
||||
+ m_output_view[outputnum] = empty_view(start, end);
|
||||
+
|
||||
// return the requested view
|
||||
return read_stream_view(m_output_view[outputnum], start);
|
||||
}
|
||||
diff --git a/src/emu/sound.h b/src/emu/sound.h
|
||||
index 15f6a574..bfa45c45 100644
|
||||
--- a/src/emu/sound.h
|
||||
+++ b/src/emu/sound.h
|
||||
@@ -284,6 +284,9 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
+ // check basic constraints
|
||||
+ bool valid() const { return m_buffer != nullptr; }
|
||||
+
|
||||
// return the local gain
|
||||
sample_t gain() const { return m_gain; }
|
||||
|
Loading…
Reference in a new issue