From 4c31c26acf51743c7b54a566768eac069ed332dc Mon Sep 17 00:00:00 2001 From: Andrey Pavlenko Date: Fri, 5 Apr 2013 08:50:37 +0400 Subject: [PATCH] fix for #2901 (en exception was raised when getting empty MatOfDMatch) --- modules/java/generator/src/java/core+MatOfDMatch.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/java/generator/src/java/core+MatOfDMatch.java b/modules/java/generator/src/java/core+MatOfDMatch.java index 7a3094933c..4a161017d4 100644 --- a/modules/java/generator/src/java/core+MatOfDMatch.java +++ b/modules/java/generator/src/java/core+MatOfDMatch.java @@ -16,8 +16,8 @@ public class MatOfDMatch extends Mat { protected MatOfDMatch(long addr) { super(addr); - if(checkVector(_channels, _depth) < 0 ) - throw new IllegalArgumentException("Incomatible Mat"); + if( !empty() && checkVector(_channels, _depth) < 0 ) + throw new IllegalArgumentException("Incomatible Mat: " + toString()); //FIXME: do we need release() here? } @@ -27,8 +27,8 @@ public class MatOfDMatch extends Mat { public MatOfDMatch(Mat m) { super(m, Range.all()); - if(checkVector(_channels, _depth) < 0 ) - throw new IllegalArgumentException("Incomatible Mat"); + if( !empty() && checkVector(_channels, _depth) < 0 ) + throw new IllegalArgumentException("Incomatible Mat: " + toString()); //FIXME: do we need release() here? }