mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Check for bad dimension every time to produce more meaningful error
git-svn-id: https://zxing.googlecode.com/svn/trunk@2269 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
9de4dd7256
commit
8768f73604
|
@ -50,11 +50,11 @@ public final class BitSource {
|
|||
* @param numBits number of bits to read
|
||||
* @return int representing the bits read. The bits will appear as the least-significant
|
||||
* bits of the int
|
||||
* @throws IllegalArgumentException if numBits isn't in [1,32]
|
||||
* @throws IllegalArgumentException if numBits isn't in [1,32] or more than is available
|
||||
*/
|
||||
public int readBits(int numBits) {
|
||||
if (numBits < 1 || numBits > 32) {
|
||||
throw new IllegalArgumentException();
|
||||
if (numBits < 1 || numBits > 32 || numBits > available()) {
|
||||
throw new IllegalArgumentException(String.valueOf(numBits));
|
||||
}
|
||||
|
||||
int result = 0;
|
||||
|
|
Loading…
Reference in a new issue