Branch: Tag:

2015-07-07

2015-07-07 13:45:56 by Arne Goedeke <el@laramies.com>

Protocols.HTTP/pgsql: fixed possible call of the NULL value

a?->b() is equivalent to (a && a->b)(). In order to make the call
optional, a?->b && a->b() has to be used, instead.

113:    switch(type) {    case 'O':    res=sprintf(DRIVERNAME"(%s@%s:%d/%s,%d,%d)", -  user,_host,_port,database,c&&c->socket?->query_fd(),backendpid); +  user,_host,_port,database,c?->socket&&c->socket->query_fd(),backendpid);    break;    }    return res;
574:      private void waitauthready() {    if(waitforauthready) { -  PD("%d Wait for auth ready %O\n",c&&c->socket?->query_fd(),backtrace()[-2]); +  PD("%d Wait for auth ready %O\n",c?->socket&&c->socket->query_fd(),backtrace()[-2]);    Thread.MutexKey lock=_shortmux->lock();    catch(PT(waitforauthready->wait(lock)));    lock=0; -  PD("%d Wait for auth ready released.\n",c&&c->socket?->query_fd()); +  PD("%d Wait for auth ready released.\n",c?->socket&&c->socket->query_fd());    }   }