ObjFW  Check-in [2c0ca29a9c]

Overview
Comment:OFOptionsParser: Fix missing nil check
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2c0ca29a9cab1a3cd8d13440b26cd319a99fe0f7ac77bfc664623f3b9f2f9fe1
User & Date: js on 2015-11-29 19:00:06
Other Links: manifest | tags
Context
2015-12-02
00:06
configure.ac: Fix posix_spawnp test check-in: 90a847c022 user: js tags: trunk
2015-11-29
19:00
OFOptionsParser: Fix missing nil check check-in: 2c0ca29a9c user: js tags: trunk
18:46
Fix compilation of ObjC++ check-in: 5826fb0441 user: js tags: trunk
Changes

Modified src/OFOptionsParser.m from [a330fd8ef3] to [aa2c46db93].

97
98
99
100
101
102
103

104
105

106
107
108

109
110
111
112

113
114
115
116
117
118
119
120
121
122
123
124

125
126
127
128
129
130
131
		    iter++, iter2++) {
			iter2->shortOption = iter->shortOption;
			iter2->longOption = nil;
			iter2->hasArgument = iter->hasArgument;
			iter2->isSpecifiedPtr = iter->isSpecifiedPtr;
			iter2->argumentPtr = iter->argumentPtr;


			@try {
				iter2->longOption = [iter->longOption copy];


				if ([_longOptions
				    valueForKey: iter2->longOption] != NULL)

					@throw [OFInvalidArgumentException
					    exception];

				[_longOptions setValue: iter2

						forKey: iter2->longOption];
			} @catch (id e) {
				/*
				 * Make sure we are in a consistent state where
				 * dealloc works.
				 */
				[iter2->longOption release];

				iter2->shortOption = '\0';
				iter2->longOption = nil;

				@throw e;

			}
		}

		_arguments = [[OFApplication arguments] retain];
	} @catch (id e) {
		[self release];
		@throw e;







>
|
|
>

|
|
>
|
|

|
>
|
|
|
|
|
|
|

|
|

|
>







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
		    iter++, iter2++) {
			iter2->shortOption = iter->shortOption;
			iter2->longOption = nil;
			iter2->hasArgument = iter->hasArgument;
			iter2->isSpecifiedPtr = iter->isSpecifiedPtr;
			iter2->argumentPtr = iter->argumentPtr;

			if (iter->longOption != nil) {
				@try {
					iter2->longOption =
					    [iter->longOption copy];

					if ([_longOptions valueForKey:
					    iter2->longOption] != NULL)
						@throw
						    [OFInvalidArgumentException
						    exception];

					[_longOptions
					    setValue: iter2
					      forKey: iter2->longOption];
				} @catch (id e) {
					/*
					 * Make sure we are in a consistent
					 * state where dealloc works.
					 */
					[iter2->longOption release];

					iter2->shortOption = '\0';
					iter2->longOption = nil;

					@throw e;
				}
			}
		}

		_arguments = [[OFApplication arguments] retain];
	} @catch (id e) {
		[self release];
		@throw e;