Skip to content

Commit

Permalink
Berry input() returns empty string and does not crash (#21565)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-hadinger authored Jun 4, 2024
1 parent 89b4376 commit 9e168d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
### Changed

### Fixed
- Berry `input()` returns empty string and does not crash

### Removed

Expand Down
5 changes: 4 additions & 1 deletion lib/libesp32/berry_tasmota/src/be_port.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@ extern "C" {

BERRY_API char* be_readstring(char *buffer, size_t size)
{
return be_fgets(stdin, buffer, (int)size);
if ((size > 0) && (buffer != NULL)) {
*buffer = 0;
}
return buffer;
}

/* use the standard library implementation file API. */
Expand Down

0 comments on commit 9e168d8

Please sign in to comment.