<commit_before>#include <BALLaxyPlugin.h>

#include <BALL/VIEW/KERNEL/mainControl.h>

namespace BALL
{
	namespace VIEW
	{
		BALLaxyPlugin::BALLaxyPlugin()
			: icon_(":pluginBALLaxy.png"),
			  preferences_(new BALLaxyInterfacePreferences()),
			  widget_(nullptr)
		{ }

		BALLaxyPlugin::~BALLaxyPlugin()
		{ }

		QString BALLaxyPlugin::getName() const
		{
			return QString("BALLaxy");
		}

		QString BALLaxyPlugin::getDescription() const
		{
			return QString("An interface to the BALLaxy workflow engine.");
		}

		const QPixmap* BALLaxyPlugin::getIcon() const
		{
			return &icon_;
		}

		ConfigDialog* BALLaxyPlugin::getConfigDialog()
		{
			return preferences_;
		}

		bool BALLaxyPlugin::activate()
		{
			if(isActive()) return true;

			BALLaxyInterface* ballaxy_interface = new BALLaxyInterface(main_control_);
			HTMLViewDock*     ballaxy_view      = new HTMLViewDock(ballaxy_interface, main_control_, String(tr("BALLaxy")).c_str());

			preferences_->storeValues();

			main_control_->addDockWidget(Qt::RightDockWidgetArea, ballaxy_view);

			widget_ = ballaxy_view;
			widget_->registerWidget(widget_);
			widget_->initializeWidget(*main_control_);

			return true;
		}

		bool BALLaxyPlugin::deactivate()
		{
			if(!isActive()) return true;

			widget_->finalizeWidget(*main_control_);
			delete widget_;
			widget_ = nullptr;

			return true;
		}

	}
}
<commit_msg>[BALLaxy] Fix: Check whether main control is set before activating the plugin<commit_after>#include <BALLaxyPlugin.h>

#include <BALL/VIEW/KERNEL/mainControl.h>

namespace BALL
{
	namespace VIEW
	{
		BALLaxyPlugin::BALLaxyPlugin()
			: icon_(":pluginBALLaxy.png"),
			  preferences_(new BALLaxyInterfacePreferences()),
			  widget_(nullptr)
		{ }

		BALLaxyPlugin::~BALLaxyPlugin()
		{ }

		QString BALLaxyPlugin::getName() const
		{
			return QString("BALLaxy");
		}

		QString BALLaxyPlugin::getDescription() const
		{
			return QString("An interface to the BALLaxy workflow engine.");
		}

		const QPixmap* BALLaxyPlugin::getIcon() const
		{
			return &icon_;
		}

		ConfigDialog* BALLaxyPlugin::getConfigDialog()
		{
			return preferences_;
		}

		bool BALLaxyPlugin::activate()
		{
			if(isActive()) return true;

			if(!main_control_)
			{
				Log.error() << "BALLaxy plugin: Undefined main control" << std::endl;
				return false;
			}

			BALLaxyInterface* ballaxy_interface = new BALLaxyInterface(main_control_);
			HTMLViewDock*     ballaxy_view      = new HTMLViewDock(ballaxy_interface, main_control_, String(tr("BALLaxy")).c_str());

			preferences_->storeValues();

			main_control_->addDockWidget(Qt::RightDockWidgetArea, ballaxy_view);

			widget_ = ballaxy_view;
			widget_->registerWidget(widget_);
			widget_->initializeWidget(*main_control_);

			return true;
		}

		bool BALLaxyPlugin::deactivate()
		{
			if(!isActive()) return true;

			widget_->finalizeWidget(*main_control_);
			delete widget_;
			widget_ = nullptr;

			return true;
		}

	}
}

{'fraction_non_alphanumeric': 0.12071888775856222, 'fraction_numerical': 0.0, 'mean_word_length': 4.334538878842676, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7313557', 'n_tokens_mistral': 1131, 'n_tokens_neox': 953, 'n_words': 173}