How do I prevent the error: System.FormatException: Input string was not in a correct format
<p>My code works just fine as long as the database returns a result set.  When it returns nothing it breaks and gives me the following error:</p>

<pre><code>System.FormatException: Input string was not in a correct format.
</code></pre>

<p>Here is my code:</p>

<pre><code>DataTable data = GeneralFunctions.GetData( query );
object sumObject;
sumObject = data.Compute( "Sum(Minutes_Spent)", "" );
if ( reportType == 1 )
{
    RepeaterPCBillable.DataSource = data;
    RepeaterPCBillable.DataBind();
    LabelPCBillable.Text = ParseTime( int.Parse( sumObject.ToString() ) ) == null
        ? ParseTime( int.Parse( sumObject.ToString() ) )
        : ""; // ERROR HERE
}
else
{
    RepeaterDTSTBillable.DataSource = data;
    RepeaterDTSTBillable.DataBind();
    LabelDTSTBillable.Text = ParseTime( int.Parse( sumObject.ToString() ) ) == null
        ? ParseTime( int.Parse( sumObject.ToString() ) )
        : "";
}
</code></pre>

<p>ParseTime:</p>

<pre><code>protected string ParseTime ( int TotalMinutes )
{
    int hours = TotalMinutes / 60;
    int minutes = TotalMinutes % 60;

    if ( hours == 0 )
    {
        return String.Format( "{0} minutes", minutes );
    }
    else if ( hours == 1 )
    {
        return String.Format( "{0} hour and {1} minutes", hours, minutes );
    }
    else if ( hours &gt; 1 )
    {
        return String.Format( "{0} hours and {1} minutes", hours, minutes );
    }
    else
    {
        return "";
    }
}
</code></pre>
