according to the docs $CFG->themedir should default to $CFG->diroot . '/theme' when not set by a site administrator. Instead it is being set to NULL.
Use the following code (defined in docs):
(assuming /var/www/ for $CFG->dirroot)
$var = $CFG->themedir .'/'. current_theme();
on a system with and without $CFG->themedir defined in config.php and look at the output for "Standard" theme:
1) system with $CFG->themedir defined will output "/var/www/theme/standard"
2) system without $CFG->themedir defined will output "/standard"
both themes should output "/var/www/theme/standard"