Commit 920b14661900672013b6ab134bc4e6d2c7d225f1

Authored by Wiebe Cazemier
1 parent acce8dfa

Fix fuzz mode

Showing 1 changed file with 7 additions and 1 deletions
mainapp.cpp
@@ -30,6 +30,8 @@ License along with FlashMQ. If not, see <https://www.gnu.org/licenses/>. @@ -30,6 +30,8 @@ License along with FlashMQ. If not, see <https://www.gnu.org/licenses/>.
30 #include "logger.h" 30 #include "logger.h"
31 #include "threadglobals.h" 31 #include "threadglobals.h"
32 #include "threadloop.h" 32 #include "threadloop.h"
  33 +#include "authplugin.h"
  34 +#include "threadglobals.h"
33 35
34 MainApp *MainApp::instance = nullptr; 36 MainApp *MainApp::instance = nullptr;
35 37
@@ -432,6 +434,9 @@ void MainApp::start() @@ -432,6 +434,9 @@ void MainApp::start()
432 std::vector<MqttPacket> packetQueueIn; 434 std::vector<MqttPacket> packetQueueIn;
433 std::vector<std::string> subtopics; 435 std::vector<std::string> subtopics;
434 436
  437 + Authentication auth(settingsLocalCopy);
  438 + ThreadGlobals::assign(&auth);
  439 +
435 std::shared_ptr<ThreadData> threaddata(new ThreadData(0, subscriptionStore, settings)); 440 std::shared_ptr<ThreadData> threaddata(new ThreadData(0, subscriptionStore, settings));
436 441
437 std::shared_ptr<Client> client(new Client(fd, threaddata, nullptr, fuzzWebsockets, nullptr, settings, true)); 442 std::shared_ptr<Client> client(new Client(fd, threaddata, nullptr, fuzzWebsockets, nullptr, settings, true));
@@ -484,7 +489,8 @@ void MainApp::start() @@ -484,7 +489,8 @@ void MainApp::start()
484 } 489 }
485 490
486 // Populate the $SYS topics, otherwise you have to wait until the timer expires. 491 // Populate the $SYS topics, otherwise you have to wait until the timer expires.
487 - threads.front()->queuePublishStatsOnDollarTopic(threads); 492 + if (!threads.empty())
  493 + threads.front()->queuePublishStatsOnDollarTopic(threads);
488 494
489 uint next_thread_index = 0; 495 uint next_thread_index = 0;
490 496