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 bug in Python "example.wbt" world #6708

Merged
merged 3 commits into from
Nov 28, 2024

Conversation

MNikoliCC
Copy link
Contributor

@MNikoliCC MNikoliCC commented Nov 27, 2024

Description
When running the simulation this error message appears: Error: wb_supervisor_field_get_type() called with invalid 'field' argument.

Related Issues
Fixes #6707

Tasks

  • Establish where the error comes from
  • Fix the error

Additional Information
I suspect that the bug is related to PR #6613.

static bool check_field(WbFieldRef f, const char *function, WbFieldType type, bool check_type, int *index, bool is_importing,
bool check_type_internal) {
if (!robot_check_supervisor(function))
return false;
if (!f) {
if (!robot_is_quitting())
fprintf(stderr, "Error: %s() called with NULL 'field' argument.\n", function);
return false;
}
// check field reference is valid
WbFieldStruct *field = field_list;
bool found = false;
while (field) {
if (field == f) {
found = true;
break;
}
field = field->next;
}
if (!found) {
fprintf(stderr, "Error: %s() called with invalid 'field' argument.\n", function);
return false;
}

The check_field failed, meaning the field reference (WbFieldRef) was not found in the field_list.
That means that the field_list is not updated correctly, or the field reference f was not properly retreived from wb_supervisor_field_get_type method.

@MNikoliCC MNikoliCC requested a review from a team as a code owner November 27, 2024 10:42
@MNikoliCC MNikoliCC marked this pull request as draft November 27, 2024 10:43
@MNikoliCC MNikoliCC changed the title First commit Fix bug in webots/projects/languages/python/worlds/example.wbt world Nov 27, 2024
@MNikoliCC MNikoliCC changed the title Fix bug in webots/projects/languages/python/worlds/example.wbt world Fix bug in Python "example.wbt" world Nov 27, 2024
@MNikoliCC MNikoliCC marked this pull request as ready for review November 28, 2024 14:31
Copy link
Member

@lukicdarkoo lukicdarkoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you

@MNikoliCC MNikoliCC merged commit 67ff848 into develop Nov 28, 2024
20 checks passed
@MNikoliCC MNikoliCC deleted the fix-bug-in-python-example-world branch November 28, 2024 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants