Null scope in effects group

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
o01eg
Programmer
Posts: 2004
Joined: Sat Dec 10, 2011 5:46 am

Null scope in effects group

#1 Post by o01eg »

EffectsGroup class checks if m_scope could be nullptr everywhere except Dump function. I've tried to put exception to constructor if scope will be nullptr but it didn't catch anything. Should we even have nullptr checks for it?
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-03-15.b3de094.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Null scope in effects group

#2 Post by Geoff the Medio »

o01eg wrote: Tue Mar 14, 2023 5:43 am EffectsGroup class checks if m_scope could be nullptr everywhere except Dump function. I've tried to put exception to constructor if scope will be nullptr but it didn't catch anything. Should we even have nullptr checks for it?
The Boost parser requires scope = ... to be specified, or else will fail to parse, so that's probably why there are no cases where it's not defined by the time it constructs the EffectsGroup object. This requirement should be kept, but it would make sense to do it in the constructor and then skip the checks everywhere else.

Post Reply