git://git.nikiroo.be
/
fanfix.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
656c0dd
)
#41 be explicit that height/width cannot be negative
author
Kevin Lamonte
<kevin.lamonte@gmail.com>
Thu, 1 Aug 2019 21:35:25 +0000
(16:35 -0500)
committer
Kevin Lamonte
<kevin.lamonte@gmail.com>
Thu, 1 Aug 2019 21:35:25 +0000
(16:35 -0500)
src/jexer/TWidget.java
patch
|
blob
|
blame
|
history
diff --git
a/src/jexer/TWidget.java
b/src/jexer/TWidget.java
index c9e0dedc2b652e60a308b5f7a7104d739fd7242c..8a49c816ac1ceb8ab847cadeef41f25b3cc30d9f 100644
(file)
--- a/
src/jexer/TWidget.java
+++ b/
src/jexer/TWidget.java
@@
-204,6
+204,13
@@
public abstract class TWidget implements Comparable<TWidget> {
protected TWidget(final TWidget parent, final boolean enabled,
final int x, final int y, final int width, final int height) {
protected TWidget(final TWidget parent, final boolean enabled,
final int x, final int y, final int width, final int height) {
+ if (width < 0) {
+ throw new IllegalArgumentException("width cannot be negative");
+ }
+ if (height < 0) {
+ throw new IllegalArgumentException("height cannot be negative");
+ }
+
this.enabled = enabled;
this.parent = parent;
this.window = parent.window;
this.enabled = enabled;
this.parent = parent;
this.window = parent.window;
@@
-234,6
+241,13
@@
public abstract class TWidget implements Comparable<TWidget> {
protected final void setupForTWindow(final TWindow window,
final int x, final int y, final int width, final int height) {
protected final void setupForTWindow(final TWindow window,
final int x, final int y, final int width, final int height) {
+ if (width < 0) {
+ throw new IllegalArgumentException("width cannot be negative");
+ }
+ if (height < 0) {
+ throw new IllegalArgumentException("height cannot be negative");
+ }
+
this.parent = window;
this.window = window;
this.x = x;
this.parent = window;
this.window = window;
this.x = x;