fix zero length std::string in putText()

This commit is contained in:
berak 2015-10-06 16:14:15 +02:00
parent 33f5ac5c15
commit f2decec3e8

View File

@ -2111,7 +2111,7 @@ void putText( InputOutputArray _img, const String& text, Point org,
pts.reserve(1 << 10);
const char **faces = cv::g_HersheyGlyphs;
for( int i = 0; text[i] != '\0'; i++ )
for( int i = 0; i < (int)text.size(); i++ )
{
int c = (uchar)text[i];
Point p;
@ -2158,7 +2158,7 @@ Size getTextSize( const String& text, int fontFace, double fontScale, int thickn
int cap_line = (ascii[0] >> 4) & 15;
size.height = cvRound((cap_line + base_line)*fontScale + (thickness+1)/2);
for( int i = 0; text[i] != '\0'; i++ )
for( int i = 0; i < (int)text.size(); i++ )
{
int c = (uchar)text[i];
Point p;