Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
8284690: [macos] VoiceOver : Getting java.lang.IllegalArgumentExcepti…
Browse files Browse the repository at this point in the history
…on: Invalid location on Editable JComboBox

Backport-of: ebfa27b9f06aee8ceceabc564a78a351903ce9a1
  • Loading branch information
mrserb committed Oct 24, 2022
1 parent 7b8afd5 commit 6a2e69d
Showing 1 changed file with 4 additions and 2 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -288,7 +288,9 @@ public String call() throws Exception {
final AccessibleEditableText aet = ac.getAccessibleEditableText();
if (aet == null) return null;

return aet.getTextRange(location, location + length);
int currentLength = aet.getCharCount();
return aet.getTextRange(Math.min(currentLength, location),
Math.min(currentLength, location + length));
}
}, c);
}
Expand Down

0 comments on commit 6a2e69d

Please sign in to comment.