@@ -1870,7 +1870,7 @@ public void fullScreen(String renderer) {
18701870
18711871
18721872 /**
1873- * @param display the screen to run the sketch on (1, 2, 3, etc. or on multiple screens using SPAN)
1873+ * @param display the screen to run the sketch on (1, 2, 3, etc. or on multiple screens using SPAN)
18741874 */
18751875
18761876 public void fullScreen (String renderer , int display ) {
@@ -7842,7 +7842,7 @@ static public void arraycopy(Object src, Object dst) {
78427842 * @see PApplet#shorten(boolean[])
78437843 */
78447844 static public boolean [] expand (boolean list []) {
7845- return expand (list , list .length << 1 );
7845+ return expand (list , list .length > 0 ? list . length << 1 : 1 );
78467846 }
78477847
78487848 /**
@@ -7855,7 +7855,7 @@ static public boolean[] expand(boolean list[], int newSize) {
78557855 }
78567856
78577857 static public byte [] expand (byte list []) {
7858- return expand (list , list .length << 1 );
7858+ return expand (list , list .length > 0 ? list . length << 1 : 1 );
78597859 }
78607860
78617861 static public byte [] expand (byte list [], int newSize ) {
@@ -7865,7 +7865,7 @@ static public byte[] expand(byte list[], int newSize) {
78657865 }
78667866
78677867 static public char [] expand (char list []) {
7868- return expand (list , list .length << 1 );
7868+ return expand (list , list .length > 0 ? list . length << 1 : 1 );
78697869 }
78707870
78717871 static public char [] expand (char list [], int newSize ) {
@@ -7875,7 +7875,7 @@ static public char[] expand(char list[], int newSize) {
78757875 }
78767876
78777877 static public int [] expand (int list []) {
7878- return expand (list , list .length << 1 );
7878+ return expand (list , list .length > 0 ? list . length << 1 : 1 );
78797879 }
78807880
78817881 static public int [] expand (int list [], int newSize ) {
@@ -7885,7 +7885,7 @@ static public int[] expand(int list[], int newSize) {
78857885 }
78867886
78877887 static public long [] expand (long list []) {
7888- return expand (list , list .length << 1 );
7888+ return expand (list , list .length > 0 ? list . length << 1 : 1 );
78897889 }
78907890
78917891 static public long [] expand (long list [], int newSize ) {
@@ -7895,7 +7895,7 @@ static public long[] expand(long list[], int newSize) {
78957895 }
78967896
78977897 static public float [] expand (float list []) {
7898- return expand (list , list .length << 1 );
7898+ return expand (list , list .length > 0 ? list . length << 1 : 1 );
78997899 }
79007900
79017901 static public float [] expand (float list [], int newSize ) {
@@ -7905,7 +7905,7 @@ static public float[] expand(float list[], int newSize) {
79057905 }
79067906
79077907 static public double [] expand (double list []) {
7908- return expand (list , list .length << 1 );
7908+ return expand (list , list .length > 0 ? list . length << 1 : 1 );
79097909 }
79107910
79117911 static public double [] expand (double list [], int newSize ) {
@@ -7915,7 +7915,7 @@ static public double[] expand(double list[], int newSize) {
79157915 }
79167916
79177917 static public String [] expand (String list []) {
7918- return expand (list , list .length << 1 );
7918+ return expand (list , list .length > 0 ? list . length << 1 : 1 );
79197919 }
79207920
79217921 static public String [] expand (String list [], int newSize ) {
@@ -7929,7 +7929,8 @@ static public String[] expand(String list[], int newSize) {
79297929 * @nowebref
79307930 */
79317931 static public Object expand (Object array ) {
7932- return expand (array , Array .getLength (array ) << 1 );
7932+ int len = Array .getLength (array );
7933+ return expand (array , len > 0 ? len << 1 : 1 );
79337934 }
79347935
79357936 static public Object expand (Object list , int newSize ) {
0 commit comments