Bug 1221520 - nullcheck for mSpeechdClient. r=eeejay
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Tue, 10 Nov 2015 19:14:02 +0900
changeset 308034 1d7d43336df1d176a58af301ac90ebb653ed6a5f
parent 308033 c2d4568291c02de3e79862a16d4118a9974de1fc
child 308035 a96097c7f61265c09f488840348b08894249b4ab
push id7422
push userpehrsons@gmail.com
push dateWed, 11 Nov 2015 04:19:53 +0000
reviewerseeejay
bugs1221520
milestone45.0a1
Bug 1221520 - nullcheck for mSpeechdClient. r=eeejay
dom/media/webspeech/synth/speechd/SpeechDispatcherService.cpp
--- a/dom/media/webspeech/synth/speechd/SpeechDispatcherService.cpp
+++ b/dom/media/webspeech/synth/speechd/SpeechDispatcherService.cpp
@@ -339,16 +339,20 @@ SpeechDispatcherService::Init()
     if (!*kSpeechDispatcherSymbols[i].function) {
       NS_WARNING(nsPrintfCString("Failed to find speechd symbol for'%s'",
                                  kSpeechDispatcherSymbols[i].functionName).get());
       return;
     }
   }
 
   mSpeechdClient = spd_open("firefox", "web speech api", "who", SPD_MODE_THREADED);
+  if (!mSpeechdClient) {
+    NS_WARNING("Failed to call spd_open");
+    return;
+  }
 
   // Get all the voices from sapi and register in the SynthVoiceRegistry
   SPDVoice** list = spd_list_synthesis_voices(mSpeechdClient);
 
   mSpeechdClient->callback_begin = speechd_cb;
   mSpeechdClient->callback_end = speechd_cb;
   mSpeechdClient->callback_cancel = speechd_cb;
   mSpeechdClient->callback_pause = speechd_cb;