File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
modules/core/include/opencv2/core Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -489,7 +489,7 @@ class CV_EXPORTS String
489
489
490
490
static const size_t npos = size_t (-1 );
491
491
492
- explicit String ();
492
+ String ();
493
493
String (const String& str);
494
494
String (const String& str, size_t pos, size_t len = npos);
495
495
String (const char * s);
@@ -627,13 +627,15 @@ String::String(const char* s, size_t n)
627
627
: cstr_(0 ), len_(0 )
628
628
{
629
629
if (!n) return ;
630
+ if (!s) return ;
630
631
memcpy (allocate (n), s, n);
631
632
}
632
633
633
634
inline
634
635
String::String (size_t n, char c)
635
636
: cstr_(0 ), len_(0 )
636
637
{
638
+ if (!n) return ;
637
639
memset (allocate (n), c, n);
638
640
}
639
641
@@ -642,6 +644,7 @@ String::String(const char* first, const char* last)
642
644
: cstr_(0 ), len_(0 )
643
645
{
644
646
size_t len = (size_t )(last - first);
647
+ if (!len) return ;
645
648
memcpy (allocate (len), first, len);
646
649
}
647
650
@@ -650,6 +653,7 @@ String::String(Iterator first, Iterator last)
650
653
: cstr_(0 ), len_(0 )
651
654
{
652
655
size_t len = (size_t )(last - first);
656
+ if (!len) return ;
653
657
char * str = allocate (len);
654
658
while (first != last)
655
659
{
You can’t perform that action at this time.
0 commit comments