Skip to content

Commit

Permalink
fixed getDataIdFromName
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Oct 19, 2021
1 parent 04cf85c commit ab4276c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/eez/gui/assets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,16 +315,20 @@ const char *getActionName(const WidgetCursor &widgetCursor, int16_t actionId) {
}
actionId--;

if (g_externalAssets == nullptr) {
if (!widgetCursor.assets) {
return "";
}

return g_externalAssets->actionNames.item(g_externalAssets, actionId);
return widgetCursor.assets->actionNames.item(widgetCursor.assets, actionId);
}

int16_t getDataIdFromName(const WidgetCursor &widgetCursor, const char *name) {
for (uint32_t i = 0; i < g_externalAssets->variableNames.count; i++) {
if (strcmp(g_externalAssets->variableNames.item(g_externalAssets, i), name) == 0) {
if (!widgetCursor.assets) {
return 0;
}

for (uint32_t i = 0; i < widgetCursor.assets->variableNames.count; i++) {
if (strcmp(widgetCursor.assets->variableNames.item(widgetCursor.assets, i), name) == 0) {
return -((int16_t)i + 1);
}
}
Expand Down

0 comments on commit ab4276c

Please sign in to comment.