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

Wrong parameter type for some at.session.Session calls #1226

Open
MikAtCosesy opened this issue Nov 28, 2022 · 1 comment
Open

Wrong parameter type for some at.session.Session calls #1226

MikAtCosesy opened this issue Nov 28, 2022 · 1 comment

Comments

@MikAtCosesy
Copy link
Contributor

The at.session.Session class has helper methods to do different at commands.
They are: action, read, test, and set.
Each of these helper methods create a corresponding at.session.Command object. The at.session.Command objects take a Duration as an input parameter, but the helper classes take a Duration? as a parameter and passes it along without a null check. This can lead to a type-check failure at runtime.
The erroneous code:

class Command:
...
  timeout/Duration

  constructor.action .name --.timeout=DEFAULT_TIMEOUT:
    type = ACTION_
...
class Session:
...
  /**
  Executes an `action` command with the $command_name.
  */
  action command_name/string --timeout/Duration?=null -> Result:
    return send
      Command.action command_name --timeout=timeout
...
@kasperl
Copy link
Member

kasperl commented Nov 29, 2022

Can you show us a stack trace from where this goes wrong and maybe the SDK version where you see this? It is okay to pass null as an argument to a method with a non-nullable parameter if it has a default value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants