[BUG REPORT] Exception in User country report

Hi,

Just reporting that In my test environment when I access “Visitors -> Location & Providers” report I got an exception with the following backtrace:


There is an error. Please report the message (Piwik 1.12) and full backtrace in the Piwik forums (please do a Search first as it might have been reported already!).

Notice: Undefined offset: 2 in /var/www/piwik/plugins/UserCountry/functions.php on line 149 

Backtrace -->

#0 Piwik_ErrorHandler(...) called at [/var/www/piwik/plugins/UserCountry/functions.php:149]
#1 Piwik_UserCountry_getPrettyCityName(...) called at [:]
#2 call_user_func_array(...) called at [/var/www/piwik/core/DataTable/Filter/ColumnCallbackReplace.php:72]
#3 Piwik_DataTable_Filter_ColumnCallbackReplace->filter(...) called at [/var/www/piwik/core/DataTable.php:396]
#4 Piwik_DataTable->filter(...) called at [/var/www/piwik/plugins/UserCountry/API.php:154]
#5 Piwik_UserCountry_API->getCity(...) called at [:]
#6 call_user_func_array(...) called at [/var/www/piwik/core/API/Proxy.php:188]
#7 Piwik_API_Proxy->call(...) called at [/var/www/piwik/core/API/Request.php:145]
#8 Piwik_API_Request->process(...) called at [/var/www/piwik/core/ViewDataTable.php:423]
#9 Piwik_ViewDataTable->loadDataTableFromAPI(...) called at [/var/www/piwik/core/ViewDataTable/HtmlTable.php:79]
#10 Piwik_ViewDataTable_HtmlTable->main(...) called at [/var/www/piwik/plugins/UserCountry/Controller.php:414]
#11 Piwik_UserCountry_Controller->checkIfNoDataForGeoIpReport(...) called at [/var/www/piwik/plugins/UserCountry/Controller.php:360]
#12 Piwik_UserCountry_Controller->getCity(...) called at [/var/www/piwik/plugins/UserCountry/Controller.php:28]
#13 Piwik_UserCountry_Controller->index(...) called at [:]
#14 call_user_func_array(...) called at [/var/www/piwik/core/FrontController.php:125]
#15 Piwik_FrontController->dispatch(...) called at [/var/www/piwik/index.php:47

Best regards,

Eric

Thanks for report. replace the line with
$countryCode = @$parts[2];

(ie. add the @ in front)

I have fixed it in Git