mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
core: handle empty Mat in Mat_ assignment operators
This commit is contained in:
parent
6bf6d1dc6b
commit
d7409604b5
@ -1744,6 +1744,11 @@ Mat_<_Tp>::Mat_(const std::array<_Tp, _Nm>& arr, bool copyData)
|
|||||||
template<typename _Tp> inline
|
template<typename _Tp> inline
|
||||||
Mat_<_Tp>& Mat_<_Tp>::operator = (const Mat& m)
|
Mat_<_Tp>& Mat_<_Tp>::operator = (const Mat& m)
|
||||||
{
|
{
|
||||||
|
if (m.empty())
|
||||||
|
{
|
||||||
|
release();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
if( traits::Type<_Tp>::value == m.type() )
|
if( traits::Type<_Tp>::value == m.type() )
|
||||||
{
|
{
|
||||||
Mat::operator = (m);
|
Mat::operator = (m);
|
||||||
@ -2125,6 +2130,11 @@ Mat_<_Tp>::Mat_(Mat&& m)
|
|||||||
template<typename _Tp> inline
|
template<typename _Tp> inline
|
||||||
Mat_<_Tp>& Mat_<_Tp>::operator = (Mat&& m)
|
Mat_<_Tp>& Mat_<_Tp>::operator = (Mat&& m)
|
||||||
{
|
{
|
||||||
|
if (m.empty())
|
||||||
|
{
|
||||||
|
release();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
if( traits::Type<_Tp>::value == m.type() )
|
if( traits::Type<_Tp>::value == m.type() )
|
||||||
{
|
{
|
||||||
Mat::operator = ((Mat&&)m);
|
Mat::operator = ((Mat&&)m);
|
||||||
|
Loading…
Reference in New Issue
Block a user