diff --git a/twisterpost.php b/twisterpost.php index c10bb83..1bd3506 100644 --- a/twisterpost.php +++ b/twisterpost.php @@ -138,9 +138,11 @@ class TwisterPost $text .= ' #' . $tagText; } } - $text = mb_substr($text, 0, $maxLen + 1); - $pos = mb_strrpos($text, ' '); - $text = mb_substr($text, 0, $pos); + if(mb_strlen($text) > $maxLen) { + $text = mb_substr($text, 0, $maxLen + 1); + $pos = mb_strrpos($text, ' '); + $text = mb_substr($text, 0, $pos); + } } return $text;