Skip to content

Commit

Permalink
[miio] Fix handling commands with curly brackets (#8897)
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
  • Loading branch information
marcelrv authored Oct 30, 2020
1 parent 74ee8e7 commit 9a5832a
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,11 @@ protected int sendCommand(String commandString) {
try {
String command = commandString.trim();
String param = "[]";
int loc = command.indexOf("[");
loc = (loc > 0 ? loc : command.indexOf("{"));
if (loc > 0) {
int sb = command.indexOf("[");
int cb = command.indexOf("{");
logger.debug("locs {}, {}", sb, cb);
if (Math.max(sb, cb) > 0) {
int loc = (Math.min(sb, cb) > 0 ? Math.min(sb, cb) : Math.max(sb, cb));
param = command.substring(loc).trim();
command = command.substring(0, loc).trim();
}
Expand Down

0 comments on commit 9a5832a

Please sign in to comment.