Show
Ignore:
Timestamp:
10/17/06 10:43:25 (2 years ago)
Author:
jordi
Message:

When searching for printers' instances, I used to set the null character to the position of the backslash without checking if the backslash was found or not, causing a crash. Now it's fixed.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/PrintPter.cxx

    r243 r255  
    108108    if ( NULL != printerAndInstanceNames ) 
    109109    { 
     110        gchar *printerName; 
    110111        gchar *slashPosition = g_strrstr (printerAndInstanceNames, "/"); 
    111         *slashPosition = '\0'; 
    112         gchar *printerName = g_strdup (printerAndInstanceNames); 
    113         *slashPosition = '/'; 
    114   
     112        if ( NULL != slashPosition ) 
     113        { 
     114            *slashPosition = '\0'; 
     115            printerName = g_strdup (printerAndInstanceNames); 
     116            *slashPosition = '/'; 
     117        } 
     118        else 
     119        { 
     120            printerName = g_strdup (printerAndInstanceNames); 
     121        } 
     122 
    115123        float pageWidth; 
    116124        float pageHeight;