Fix for error messages when loading completions

This commit is contained in:
ridiculousfish 2012-02-26 01:15:53 -08:00
parent 38e40862fe
commit 94a764d6ea
2 changed files with 11 additions and 1 deletions

View File

@ -1151,7 +1151,7 @@ env_var_t env_get_string( const wcstring &key )
{
if( res->val == ENV_NULL )
{
return wcstring(L"");
return env_var_t::missing_var();
}
else
{

10
env.h
View File

@ -100,6 +100,7 @@ private:
bool is_missing;
public:
static env_var_t missing_var(void);
env_var_t(const env_var_t &x) : wcstring(x), is_missing(x.is_missing) { }
env_var_t(const wcstring & x) : wcstring(x), is_missing(false) { }
env_var_t(const wchar_t *x) : wcstring(x), is_missing(false) { }
env_var_t() : wcstring(L""), is_missing(false) { }
@ -111,6 +112,15 @@ public:
wcstring::operator=(s);
return *this;
}
bool operator==(const env_var_t &s) const {
if (is_missing && s.is_missing)
return true;
else if (s.is_missing || s.is_missing)
return false;
else
return *static_cast<const wcstring *>(this) == *static_cast<const wcstring *>(&s);
}
};
/**