Avoid crashes
This commit is contained in:
parent
82bc60d510
commit
b1b191a6e7
@ -79,8 +79,12 @@ public class MessageEntity implements BotApiObject {
|
||||
public void computeText(String message) {
|
||||
if (message != null) {
|
||||
byte[] bytes = message.getBytes(StandardCharsets.UTF_16LE);
|
||||
text = new String(Arrays.copyOfRange(bytes, offset, offset + length),
|
||||
StandardCharsets.UTF_16LE);
|
||||
if (bytes.length >= offset && offset >= 0 && length >= 0) {
|
||||
text = new String(Arrays.copyOfRange(bytes, offset, offset + length),
|
||||
StandardCharsets.UTF_16LE);
|
||||
} else {
|
||||
text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user