Bug 1890 - Array preference is not created if it doesn't exist
: Array preference is not created if it doesn't exist
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Plugins
: 6.2.0
: PC All
: P2 normal (vote)
: ---
Assigned To: Robert Moser II
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-07-29 13:24 UTC by Michael Herger
Modified: 2008-09-15 14:36 UTC (History)
0 users

See Also:
Category: ---


Attachments
create new array value if it doesn't exist yet (558 bytes, patch)
2005-07-30 00:16 UTC, Michael Herger
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Herger 2005-07-29 13:24:02 UTC
I have a problem setting an array value in a plugin: ShoutCast's sorting criteria is never stored and 
used. Streams therefore aren't sorted at all. Though the setting shows up on the plugins page, 
onChange is never called. I tried to reproduce it using other parameters and other plugins, but no 
luck. 

I think it's rather a problem with the new preferences stuff than with the plugin itself (of course!).
Comment 1 Michael Herger 2005-07-30 00:16:44 UTC
Created attachment 685 [details]
create new array value if it doesn't exist yet

The problem seems to be the new set() code: if there's no previous array value
stored in $prefs{$key} nothing is done. The code checks whether it's an array
or hash, but doesn't do anything if neither of them, thus not creating new
array values in the preferences hash. This patch might help.
Comment 2 Michael Herger 2005-07-30 00:21:56 UTC
Change the summary - the old was misleading
Comment 3 Robert Moser II 2005-07-31 12:40:29 UTC
Close, but it fails in the case where a new hash preference is being set.

I'd also add an $ind !~ /\D/ check before assuming an array pref with the final
else being a hash pref.
Comment 4 Robert Moser II 2005-08-02 10:27:19 UTC
Should be fixed with change 3845.