Handling situation when resolutions array is null.

This commit is contained in:
codeanticode
2011-10-10 18:17:43 +00:00
parent d5c7f19dca
commit a93ffc7d98
@@ -473,11 +473,18 @@ public class Capture extends PImage implements PConstants {
* @return Resolution[]
*/
public Resolution[] resolutions() {
int n = resolutions.size();
Resolution[] res = new Resolution[n];
for (int i = 0; i < n; i++) {
res[i] = new Resolution((Resolution)resolutions.get(i));
Resolution[] res;
if (resolutions == null) {
res = new Resolution[0];
} else {
int n = resolutions.size();
res = new Resolution[n];
for (int i = 0; i < n; i++) {
res[i] = new Resolution((Resolution)resolutions.get(i));
}
}
return res;
}