In the English version compiled for Mac OS X (based on the 2.2.1.7 master branch), if neither of the autopick preference files are present and the player selects 'Auto' when destroying an object, the game crashes with a segmentation fault. The top of the call stack at the point of the crash is:
libsystem_c.dylib`flockfile + 18
libsystem_c.dylib`fgets + 42
hengband`my_fgets(fff=0x0000000000000000, buf="\x90Ϳ??", n=1024) at util.c:445:6
hengband`autopick_autoregister(o_ptr=0x0000000109e5fec4) at autopick.c:1959:7
hengband`do_cmd_destroy at cmd-item.c:694:9
In that situation, the first two my_fopen(pref_file, 'r') calls in autopick_autoregister() return a null pointer so pref_fff is null when my_fgets() is called in the while loop. The attached patch resolves the problem by skipping the while loop and close if neither of the preference files could be opened. It does try to append to the preference file (i.e. create it if necessary) in that situation.
In the English version compiled for Mac OS X (based on the 2.2.1.7 master branch), if neither of the autopick preference files are present and the player selects 'Auto' when destroying an object, the game crashes with a segmentation fault. The top of the call stack at the point of the crash is:
In that situation, the first two my_fopen(pref_file, 'r') calls in autopick_autoregister() return a null pointer so pref_fff is null when my_fgets() is called in the while loop. The attached patch resolves the problem by skipping the while loop and close if neither of the preference files could be opened. It does try to append to the preference file (i.e. create it if necessary) in that situation.