Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix WUPSConfigItemV1::onCloseCallback #68

Merged
merged 2 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions source/config/WUPSConfigItemV1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ namespace WUPSConfigAPIBackend {
void WUPSConfigItemV1::onCloseCallback() {
if (this->mCallbacks.callCallback == nullptr) {
DEBUG_FUNCTION_LINE_VERBOSE("callCallback callback not implemented. [%s]", mDisplayName.c_str());
return;
}
if (mDefaultValue != getCurrentValueDisplay()) {
this->mCallbacks.callCallback(mContext);
Expand Down
7 changes: 7 additions & 0 deletions source/plugin/PluginMetaInformationFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ std::optional<PluginMetaInformation> PluginMetaInformationFactory::loadPlugin(st

uint32_t sec_num = reader.sections.size();

bool hasMetaSection = false;
for (uint32_t i = 0; i < sec_num; ++i) {
ELFIO::section *psec = reader.sections[i];

Expand All @@ -72,6 +73,7 @@ std::optional<PluginMetaInformation> PluginMetaInformationFactory::loadPlugin(st

// Get meta information and check WUPS version:
if (psec->get_name() == ".wups.meta") {
hasMetaSection = true;
const void *sectionData = psec->get_data();
uint32_t sectionSize = psec->get_size();

Expand Down Expand Up @@ -118,6 +120,11 @@ std::optional<PluginMetaInformation> PluginMetaInformationFactory::loadPlugin(st
}
}
}
if (!hasMetaSection) {
DEBUG_FUNCTION_LINE_ERR("File has no \".wups.meta\" section");
error = PLUGIN_PARSE_ERROR_NO_PLUGIN;
return {};
}

pluginInfo.setSize(pluginSize);

Expand Down
1 change: 1 addition & 0 deletions source/plugin/PluginMetaInformationFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
enum PluginParseErrors {
PLUGIN_PARSE_ERROR_NONE,
PLUGIN_PARSE_ERROR_UNKNOWN,
PLUGIN_PARSE_ERROR_NO_PLUGIN,
PLUGIN_PARSE_ERROR_INCOMPATIBLE_VERSION,
PLUGIN_PARSE_ERROR_BUFFER_EMPTY,
PLUGIN_PARSE_ERROR_ELFIO_PARSE_FAILED,
Expand Down
1 change: 1 addition & 0 deletions source/utils/exports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ extern "C" PluginBackendApiErrorType WUPSGetPluginMetaInformationEx(WUPSBackendG
case PLUGIN_PARSE_ERROR_BUFFER_EMPTY:
case PLUGIN_PARSE_ERROR_ELFIO_PARSE_FAILED:
case PLUGIN_PARSE_ERROR_IO_ERROR:
case PLUGIN_PARSE_ERROR_NO_PLUGIN:
*errOut = PLUGIN_BACKEND_PLUGIN_PARSE_ERROR_UNKNOWN;
break;
}
Expand Down