Skip to content

Commit

Permalink
adding more checks to method
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorVieiraZ committed Jul 24, 2024
1 parent 0f8a801 commit ff78037
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions core/merginapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1591,13 +1591,22 @@ ProjectDiff MerginApi::localProjectChanges( const QString &projectDir )

bool MerginApi::parseVersion( const QString &version, int &major, int &minor )
{
if ( version.isNull() || version.isEmpty() )
return false;

QRegularExpression re;
re.setPattern( QStringLiteral( "(?<major>\\d+)[.](?<minor>\\d+)" ) );
re.setPattern( QStringLiteral( R"((?<major>\d+)\.(?<minor>\d+))" ) );
QRegularExpressionMatch match = re.match( version );

if ( match.hasMatch() )
{
major = match.captured( "major" ).toInt();
minor = match.captured( "minor" ).toInt();
bool majorOk, minorOk;
major = match.captured( "major" ).toInt( &majorOk );
minor = match.captured( "minor" ).toInt( &minorOk );

if ( !majorOk || !minorOk )
return false;

return true;
}

Expand Down

1 comment on commit ff78037

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS - version 24.7.643411 just submitted!

Please sign in to comment.