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

String consturctor causing ESP to crash? #35

Open
witnessmenow opened this issue Oct 2, 2020 · 1 comment
Open

String consturctor causing ESP to crash? #35

witnessmenow opened this issue Oct 2, 2020 · 1 comment

Comments

@witnessmenow
Copy link
Owner

As mentioned in #34, need to investigate

@dmadison
Copy link
Contributor

dmadison commented Oct 2, 2020

There's two reasons for this.

First is that the String is stored in a temporary buffer in the constructor. This temporary buffer is then passed to the char* constructor which stores the address for later reference. Once the function exits the buffer no longer exists and the memory address is invalid. You can try this by assigning _apiKey directly in the String constructor.

Second is that the constructor call is not delegated, so this line creates a new YoutubeApi object and then immediately throws it away instead of modifying the current object.

I'll push a tentative working fix to the branch, but we should discuss some of the alternatives in the PR.

dmadison added a commit to dmadison/arduino-youtube-api that referenced this issue Oct 2, 2020
See issue witnessmenow#35 and discussion of replacement in witnessmenow#34.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants